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
Ghaston
Helper I
Helper I

problem with filtring

hi 
i'm using Direct Qid_uery and i'm having a hard time filtring my date with "CALCULATE" function. 
I have a Column "ID_OF", and i want to run the result juste for the highest value of "ID_OF". 
So i created this mesure : 
g.PNG

But it didn't work. I get the result for all "ID_OF" and not the max as i wanted. 
So i put the "last_OF" variable, in a mesure : 
gf.PNG

And this mesure gave me the max value of "ID_OF" as planned. Wich is 12198 in this case. 
l.PNG
But i don't understand why it didn't work on my first formula? i changed the variable "Last_OF" with the mesure that i have just created "Last_OF", but nothing changes. 
However, i get the result that i'm expecting when i replace 'Last_OF" by it's value :12198. 
gjh.PNG

Need help please

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Ghaston,

 

Actually when you were calculating last_of in your variable that is dynamic and you provide a scenario where you are fixing a fixed value like 12198.

So in variable also you have to do same, by filtering all table data.

 

Capture.JPG 

 

Hope this will solve your problem. i have also sent you pbix file.

 

Best Regards,

Ravi

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @Ghaston

 

Could you please some temp data for it or pbix file?

 

 

Regards,

Ravi

hi @Anonymous

I'm using Direct Query, so u won't be able to open my pbix file. 
So i created for you this new one : 
https://drive.google.com/open?id=1hIOrBiDhahKZg87QaCJo5hTcDEHvJAcv

Anonymous
Not applicable

Hi @Ghaston

 

Please find the drive link for the Solution. Test.pbix.

 

 

Best Regards,

Ravi

Anonymous
Not applicable

Hi @Ghaston,

 

Actually when you were calculating last_of in your variable that is dynamic and you provide a scenario where you are fixing a fixed value like 12198.

So in variable also you have to do same, by filtering all table data.

 

Capture.JPG 

 

Hope this will solve your problem. i have also sent you pbix file.

 

Best Regards,

Ravi

hi @Anonymous

That worked perfectly!
Thanks.,
But i didn't understand why my code didn't work. Can you explain that for me please? i would appreciate it

Anonymous
Not applicable

Yeah,  Sure.

 

I have explained you above Smiley Happy

 

Once more....

See when you are calculating the "last_of" variable and putting that on card it is showing you data without any filteration. But in line chart you are using that "last_of" against the Date. Every Date has  different "last_of" value you can also verify that by putting last_of in table with date.

Actually your motive is to show total value having Ligne="ligne 68". Thats why i have calculated with all filter.

 

Regards,

Ravi

 

Helpful resources

Announcements
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.

May 2025 Monthly Update

Fabric Community Update - May 2025

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