Forum Discussion
MEASURE for totals from matrix
- 4 years ago
Hi Gheb_Gabriela ,
For this you need to redo the formula you use for the matrix values. I have used the following data for example:
Now add the following measure to your dataset:
Adjusted Value = IF ( HASONEVALUE ( 'Table'[Cat] ), SUM ( 'Table'[Value] ), SUM ( 'Table'[Value] ) - CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( ALL ( 'Table'[Year], 'Table'[Quarter], 'Table'[Time] ), 'Table'[Year] = SELECTEDVALUE ( 'Table'[Year] ) - 1 && 'Table'[Quarter] = SELECTEDVALUE ( 'Table'[Quarter] ) ) ) )Check PBIX file attach.
Hi Gheb_Gabriela ,
What do you mean by you have blanks instead of 0? In my model the values are also blanks and not 0. Can you please provide further insight on that part?
Hi MFelix ,
Yes, I know, but your example is just an example, for my report because of the blanks from matrix, if I want to filter only Q1FY19 and Q2FY19, those values with 0 means that i will be not able to see also all the others category ( as is in your example A,B) and i need them to be there even they have 0 value, for my company.
Do you understand what i mean?
Thanks! Appreciate your quick reply
- MFelix4 years ago
Super User
You mean that the matrix lines can be blank correct liken the image below the category dissapears:
In this case best option is to select the visual and on the line values select the option Show items with no Data:
- Gheb_Gabriela4 years agoFrequent Visitor
MFelix i've tried this solution from the begging, but no... it's not showing "0". Maybe, it's from my database... the column with the values should be formatted different or something like this.
Thanks
- MFelix4 years ago
Super User
Try to rearrange the measure to:
Adjusted Value = IF ( HASONEVALUE ( 'Table'[Cat] ), SUM ( 'Table'[Value] ) + 0, SUM ( 'Table'[Value] ) - CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( ALL ( 'Table'[Year], 'Table'[Quarter], 'Table'[Time] ), 'Table'[Year] = SELECTEDVALUE ( 'Table'[Year] ) - 1 && 'Table'[Quarter] = SELECTEDVALUE ( 'Table'[Quarter] ) ) ) )The +0 is only on the first part of the IF statement,