Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
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,
Date | Cases |
2020-01-01 | 1 |
2020-01-02 | 2 |
2020-01-03 | 3 |
2020-01-04 | 4 |
2020-01-05 | 5 |
I'd retrieve the previous number of each day, i.e.
Date | Cases | Previous |
2020-01-01 | 1 | |
2020-01-02 | 2 | 1 |
2020-01-03 | 3 | 2 |
2020-01-04 | 4 | 3 |
2020-01-05 | 5 | 4 |
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
whereas I got an expected result if I drag columns into a table viz by order of Date - Cases - Measure.
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! |
@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]))
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
11 | |
10 | |
10 | |
10 |
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
8 |