Number of Days in Selected Month

Dear Team ,

 I would like to know number of days in selected Month ,  

Meaning that when I select Oct , I get number of days is 31 , Feb is 28 but
when I select oct to Nov , so I want total number of days for both month is 61.
or Oct to Dec -92 days.
I have date field but I just numbers of days of this month in selected date field.
Thanks in Advance,
TZ

Hi @ThawZin

You can calculate the number of days in the selected range by creating a calculated field that determines the start and end of the selection and then computes the difference in days.

Use the following formula to calculate the number of days between the selected start and end dates. This will give you the number of days between the start and end dates. Adding +1 ensures that both start and end dates are included in the count.

Example: (Syntax may vary - replace the fields from your dataset)

dateDiff({StartDate}, {EndDate}, 'DD') + 1

Please refer the below QuickSight documentation this might be helpful for you.

thank you for your answer but I just need number of days for selected Month.
If user select Oct to Dec , We don’t consider which day starts , just consider on selected month , OCt and Dec , so must be 62

Hi @ThawZin

You can use a calculated field to assign the number of days to each month, making it easy to group by Month Name. Please try following calculated field.

Example: (Syntax may vary - replace the fields from your dataset)

Month No - 

max(
switch(
    extract('MM', Date),
    1, 31,
    2, 28,
    3, 31,
    4, 30,
    5, 31,
    6, 30,
    7, 31,
    8, 31,
    9, 30,
    10, 31,
    11, 30,
    12, 31,
    0
),
[{Month Name}]
)

Month Name - 

switch(
    extract('MM', Date),
    1, "January",
    2, "February",
    3, "March",
    4, "April",
    5, "May",
    6, "June",
    7, "July",
    8, "August",
    9, "September",
    10, "October",
    11, "November",
    12, "December",
    ""
)



Sum_Month

Hi @ThawZin,
It’s been awhile since we last heard from you, did you have any additional questions regarding your initial post?

If we do not hear back within the next 3 business days, I’ll go ahead and close out this topic.

Thank you!

Hi @ThawZin,
Since we haven’t heard back, I’ll close out this topic. However, if you have any additional questions, feel free to create a new post in the community and link this discussion for relevant information if needed.

Thank you!