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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
CNENFRNL
Community Champion
Community Champion

Filter context of table viz

Dear gurus,

Once again, I can't wrap head around a seemingly silly simple question: what is the filter context of a table viz?

I even came across a funny scene in this regard.

Here's a very simple dataset,

DateCases
2020-01-011
2020-01-022
2020-01-033
2020-01-044
2020-01-055

 

I'd retrieve the previous number of each day, i.e. 

DateCasesPrevious
2020-01-011 
2020-01-0221
2020-01-0332
2020-01-0443
2020-01-0554

 

here's the measure

 

Measure = 
VAR __prev = MAX ( DS[Date] ) - 1
RETURN CALCULATE ( MAX ( DS[Cases] ), DS[Date] = __prev )

When I drag columns into a table viz by order of Cases - Date - Measure, I got ONLY BLANK TABLE

 

Screenshot 2020-11-08 234000.png

whereas I got an expected result if I drag columns into a table viz by order of Date - Cases - Measure.

Screenshot 2020-11-08 234222.png

 

No any other viz, slicers or filters exist in my scenario. Therefore, I suspect that such a funny scene results from the filter context, which influence the calculation of the measure. I googled but it turned out (perhaps I didn't find) any explicit clarification of such a subject: what on earth is the filter context of a table viz? what's even more, could it be possible that order of columns in table viz produce different filter context?

 

Your help would be highly appreciated! TIA

(I attached the file for your trial)


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

2 REPLIES 2
amitchandak
Super User
Super User

@CNENFRNL , Try a new column like

Column = maxx(FILTER('Table (2)', 'Table (2)'[Date] <EARLIER('Table (2)'[Date])),LASTNONBLANKVALUE('Table (2)'[Date],'Table (2)'[Cases]))

 

Screenshot 2020-11-09 07.23.29.png

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

@CNENFRNL that did not happen in my computer, whatever the order of draging columns into Table viz, the result is normal and correct, depending on the field of Cases is Whole Number.

but ,when the Cases is in Text type, the result is blank like yours, even change the order to drag the columns, it is still blank.

then i adjusted the code to add a filter statement, the normal result came back.

 

Measure = 
VAR __prev = MAX ( DS[Date] ) - 1
RETURN CALCULATE ( MAX ( DS[Cases] ), DS[Date] = __prev ,ALL(DS[Cases]))

 

 

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.