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.
Hi everyone,
I don't understand the result of the Total row (I expect it was 4)
Here the data:
Anyone help me?
Solved! Go to Solution.
Hi,
I recommend reading this article by SQLBI about the total row: https://www.sqlbi.com/articles/why-power-bi-totals-might-seem-inaccurate/
The behaviour of totals is a bit wonky in Power BI.
For a solution try something like this:
Dax:
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
Proud to be a Super User!
hi @hungbm12
Trying to understand how your code works. It shall be executed like this:
measure 3 =
SUMX(
DISTINCT(Sheet1[category]), //1.scans category A then B
CALCULATE( //2.convert row context A(B) to filter context A(B)
SUM( Sheet1[value]), //7. it get 2+2 when scanning A in step 1 and another 2+2 in scanning B, so comes 8
FILTER( // 6. filter context A(B) is replaced by the outcome of FILTER, which is two 24 Dec rows.
Sheet1, //3.scan the original Sheet1
VAR _maxdate = MAX(Sheet1[Date]) // 4. _maxdate equals 24 Dec
RETURN [date]=_maxdate //5. filter in two rows on 24 Dec.
)
)
)
p.s.
[date]=MAX(Sheet1[Date])
is a misleading syntax sugar and thus extended to:
VAR _maxdate = MAX(Sheet1[Date])
RETURN [date]=_maxdate
Hi,
I recommend reading this article by SQLBI about the total row: https://www.sqlbi.com/articles/why-power-bi-totals-might-seem-inaccurate/
The behaviour of totals is a bit wonky in Power BI.
For a solution try something like this:
Dax:
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
Proud to be a Super User!
I'm sorry but if I changed the 4th row to December 28th, Total row = 2 (not as I expect). I expect it get the newest value of each Category and return 4
User | Count |
---|---|
14 | |
9 | |
7 | |
7 | |
6 |
User | Count |
---|---|
21 | |
11 | |
10 | |
9 | |
8 |