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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

usage of Dax function filter

Hello,

I can't get my head around as to why the dax measure below (Number 1) doesn't work the way i want. I thought both 1 and 2 measures should behave the same way but not. Can someone explain me why the first dax measure doesn't filter to show only the last day records?

 

image.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous 

Please try my measure:

test3 = 
VAR _MaxDate = MAXX(ALL('Table'),'Table'[Gaming Date])
RETURN
CALCULATE(COUNT('Table'[Gaming Date]),FILTER('Table','Table'[Gaming Date]=_MaxDate))

My Sample:

2.png

Result is as below. Test1 and test2  are measures like yours, you see test3 will get the correct result dynamiclly instead of use "Date" fucntion.

3.png

Best Regards,

Rico Zhou

 

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

13 REPLIES 13
Anonymous
Not applicable

Hi @Anonymous 

Please try my measure:

test3 = 
VAR _MaxDate = MAXX(ALL('Table'),'Table'[Gaming Date])
RETURN
CALCULATE(COUNT('Table'[Gaming Date]),FILTER('Table','Table'[Gaming Date]=_MaxDate))

My Sample:

2.png

Result is as below. Test1 and test2  are measures like yours, you see test3 will get the correct result dynamiclly instead of use "Date" fucntion.

3.png

Best Regards,

Rico Zhou

 

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

Anonymous
Not applicable

Hi @Anonymous 
That is exactly what I am after . you are a legend :).

Decided not to waste my time replying until I get a proper solution as I have given enough information. Really happy that it crossed you.

Thanks again.

 

Cheers,

Deevs

parry2k
Super User
Super User

@Anonymous just asked a simple question, Read this post to get your answer quickly. It helps everyone.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@Anonymous what you want to achieve? You just asked why measure 1 is different than measure 2 but you never explained what you are looking for. @Anonymous gave an explanation of the difference between measure 1 and measure 2.

 

In nutshell, @Anonymous answered your original question but if you need a further solution, you should tell what you are looking for. 

 

Well done @Anonymous 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k 

 

Calm Down you might end up with high blood pressure lol.

 

@Anonymous 
I want to count the records but based on a specific time period, say based on the max day or min day of the table.. If I drag the date into a table along with the measure I should only get the values based on the time period applied within the dax measure. Hope that makes sense.

 

How do you modify the below measure to achivew that. I want the table to only show the last day, not all.

Deevs_411470_2-1611121988120.png

 

 

 

 

 

 

 

 

Anonymous
Not applicable

Hi @Anonymous 

I agree with @parry2k and really hope that you use his link on how to get answers quickly.

Your initial ask and the purpose of this post is fulfilled with my first reply.
To keep the sanity of the post you already have your answer. This is going to be a new post my friend.

 

You should appreciate people trying to help here investing our personal time we can be doing something else helping other get through with work task. which demands only one thing.

Anonymous
Not applicable

 

lol  "myfrind"   "Your initial ask and the purpose of this post is fulfilled with my first reply."

Anonymous
Not applicable

Hi @Anonymous 

To reply to your question about why measure1 doesn't work and measure2 works is 
Measure1 is still working on each row for max function and it sees the data in current row as max.
Now to make it work you need to let the whole calculation know that it needs to work on the entire selected table and that is what ALLSELECTED does.

Anonymous
Not applicable

@Anonymous 

I used that but got the same results.

Deevs_411470_0-1611117982084.png

 

 

 

 

Anonymous
Not applicable

Hi @Anonymous 

Remove filter funcion from your measure

amitchandak
Super User
Super User

@Anonymous , In the filter one,

You have to use as the example

calculate([measure], filter(allselected(Table), [Date] =max([Date]))

 

allselected is important

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
Anonymous
Not applicable

@amitchandak 

 

Still the same. not filtering the max day data.

 

Deevs_411470_0-1611111303231.png

 

@Anonymous ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 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.

Top Solution Authors