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

Win a FREE 3 Day Ticket to FabCon Vienna. Apply now

Reply
bsheffer
Continued Contributor
Continued Contributor

how to get the min and max of a page filter to use in a measure

I have a filter on date in the filter pane

 

the only way I seem to be able to remove filters from the filters pane is to use the all(table) command.  I've tried all(column) and allexcept to no avail.  Now I want to do a total count of all rows in a date horizontal barchart with date on the y axis and number of rows on the x axis.  I want to put the total count in the tool tips.

 

however because it is segmented by date the total count is coming up the same as the count for that date.

if I use calculate(distinctcount(account_number), all(date)) it returns the same number

if I use variables: min(date) and max(date) in the calculate statement, it is giving the same date for that bar of the barchart.  What I really need it seems is to get the min date from the filter and max date from the filter in the filter pane.

 

Is there a way to do this in dax only?

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @bsheffer 

 

Based on your description, I created data to reproduce your scenraio. The pbix file is attached in the end.

Test:

c1.png

 

You may create a measure as below.

Count = 
CALCULATE(
    DISTINCTCOUNT(Test[AccountNumber]),
    ALLSELECTED('Test')
)

 

Result:

c2.png

c3.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-alq-msft
Community Support
Community Support

Hi, @bsheffer 

 

Based on your description, I created data to reproduce your scenraio. The pbix file is attached in the end.

Test:

c1.png

 

You may create a measure as below.

Count = 
CALCULATE(
    DISTINCTCOUNT(Test[AccountNumber]),
    ALLSELECTED('Test')
)

 

Result:

c2.png

c3.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@bsheffer , Not very clear

Try like

min date = minx(allselected(Date), date)
max date = maxx(allselected(Date), date)

 

Can you share sample data and sample output in table format?

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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