Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
delphinecarnet
Frequent Visitor

Number of days in month with multiple month selection

Dear PowerBI Community,

 

I'm attempting to create a MEASURE to calcultate the number of days in month. 

The DAX formula works fine for a single month, but when I add another month from the filter, the formula return blank

I've tried a few combinations here but I'm at a loss.

 

Thanks for all your help!

 

 

 

 

DaysinMonth = DAY( EOMONTH(SELECTEDVALUE(DATA[DATE1] ), 0 ))

 

 

 

delphinecarnet_0-1687357002317.png

 

3 REPLIES 3
Alf94
Super User
Super User

Hi @delphinecarnet ,

 

What is your expected output? Total number of days? Average number of days? Minimum? Maximum? We need to know to help you 🙂

 

Best,

Thanks for your reply!

 

In this case, I'm expecting 61 which is March + April.

On the left when only April is selected, it does return the correct number of days in the month which is 30 but when I choose an extra month it return blank.

@delphinecarnet,

 

From what I see, you do not have a date table in your model. I would suggest you to first create one, then use the following measure:

 

DaysinMonth = COUNTROWS( DateTable )

 

Alf94_1-1687360916902.pngAlf94_2-1687360959200.png

 

If I answered your question, please mark my post as a solution.

 

Best,

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.