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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Dax Measure with dynamic date

I need help. 

 

I am trying to create a measure that counts the # of items ordered since an account was created. I manually keyed 01/01/2022 in the measure below and was able to get the result I expected. 

 

COUNTROWS(

        GROUPBY(FILTER(Table,Table[First Sample Date]>= DATE(2022,01,01)),Table[Sample ID],Table[Order Choice Type])

)

 

Unfortunately, I can't figure out how to update the syntax in the measure to dynamically display correctly based on the minimum date in the visual or a slicer.  

 

COUNTROWS(

        GROUPBY(FILTER(Table,Table[First Sample Date]>= CALCULATE(min('Calendar'[DATE]),ALLSELECTED('Calendar'[DATE])),Table[Sample ID],Table[Order Choice Type])

)

 

Below are screenshots of the baseline (with the expected values) as well as the incorrect values based on my failed attempt. 

 

mjwssc_0-1671760062060.png

 

Any help is appreciated!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try like

 


New=
var _min = minx(allselected('Calendar') ,'Calendar'[DATE])
return

calculate(COUNTROWS(Summarize(Table, Table[Sample ID],Table[Order Choice Type])),FILTER(Table,Table[First Sample Date]>= _min)
)

or


New=
var _min = minx(allselected('Calendar') ,'Calendar'[DATE])
return

calculate(COUNTROWS(Summarize(Table, Table[Sample ID],Table[Order Choice Type])),FILTER(all(Table),Table[First Sample Date]>= _min)
)

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , Try like

 


New=
var _min = minx(allselected('Calendar') ,'Calendar'[DATE])
return

calculate(COUNTROWS(Summarize(Table, Table[Sample ID],Table[Order Choice Type])),FILTER(Table,Table[First Sample Date]>= _min)
)

or


New=
var _min = minx(allselected('Calendar') ,'Calendar'[DATE])
return

calculate(COUNTROWS(Summarize(Table, Table[Sample ID],Table[Order Choice Type])),FILTER(all(Table),Table[First Sample Date]>= _min)
)

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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