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
BharathM
Helper IV
Helper IV

Dax measure need urgent help need

i need a measure that returns the number of days based on a month year slicer selction, if the selection made was of current running month then it shoud return us the number of days completed in that particular month or else it should return the total days that are present in any month like 30 or 31 or 28 , for suppose if i select the current month that is dec-2022 then number of days at present it should return 21, if i select any completd month suppose feb 2022 then it should return me 28 days as the total days should be total of a completed month

1 ACCEPTED SOLUTION
DimaMD
Solution Sage
Solution Sage

@BharathM  Hi try it

Measure = 
 VAR _1 = DATEDIFF(MIN('dates'[Date]),MAX('dates'[Date]),DAY)+1
 VAR _2 =  CALCULATE(COUNTROWS(DATESBETWEEN('dates'[Date],MIN('dates'[Date]),TODAY())))
 return
 IF( _1 >= _2 , _2,_1 )

__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

View solution in original post

1 REPLY 1
DimaMD
Solution Sage
Solution Sage

@BharathM  Hi try it

Measure = 
 VAR _1 = DATEDIFF(MIN('dates'[Date]),MAX('dates'[Date]),DAY)+1
 VAR _2 =  CALCULATE(COUNTROWS(DATESBETWEEN('dates'[Date],MIN('dates'[Date]),TODAY())))
 return
 IF( _1 >= _2 , _2,_1 )

__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

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.

Top Solution Authors