Forum Discussion
conditional measure total is wrong in power bi table matrix
- 4 years ago
This can be handled with a separate totals measure. I'm assuming your date table has a [Year Month] column (or similar). If not, it's worth adding to your date table.
Base Measure = IF ( MONTH ( MAX ( 'Calender 2'[Date] ) < MONTH ( TODAY () ) ), SUM ( 'Value Entry Stock All Items'[Sales Amount (Actual)] ), SUM ( Targets[JAN Target] ) )Total Measure = SUMX ( VALUES ( 'Calender 2'[Year Month] ), [Base Measure] )
This can be handled with a separate totals measure. I'm assuming your date table has a [Year Month] column (or similar). If not, it's worth adding to your date table.
Base Measure =
IF (
MONTH ( MAX ( 'Calender 2'[Date] ) < MONTH ( TODAY () ) ),
SUM ( 'Value Entry Stock All Items'[Sales Amount (Actual)] ),
SUM ( Targets[JAN Target] )
)Total Measure =
SUMX ( VALUES ( 'Calender 2'[Year Month] ), [Base Measure] )
- gulbazk4 years agoRegular Visitor
Thank u soooo much Bro. It worked for me.
- Gulbaz4 years agoFrequent Visitor
Thaank u sooo much bro! It worked for me.
- Martin742 years ago
Helper I
Hello DataInsights ,
Athough your answer is over a year old, it helped me really a lot. I had a measure that was not calculating the total in a good way. After seraching in the community I tried your answer and with some modification it worked just fine. Now the totals are right, so if the customer need the min/max etc. it also worked.
Keep up answering, thanks a lot.
With kind regards,
Martin
- DataInsights2 years ago
Super User
Thanks for the feedback! Glad to hear this solution helped. See the solution below for a different approach that uses KEEPFILTERS.
On a side note, consider using DIVIDE instead of the division operator to handle division by zero. Good luck!
- KelvinTH44442 years agoRegular Visitor
Thank you for this solution that I saw the same too. I wanna know why you use [Year Month]
- DataInsights2 years ago
Super User
The field [Year Month] provides uniqueness (based on the provided screenshot) in a single field. Otherwise, you would need to summarize unique combinations of Year and Month.
- KelvinTH44442 years agoRegular Visitor
I see. Thank you for your descriprtion. 😊
- Anonymous2 years agoNot applicable
Thanks DataInsights !! It worked for me.. Could you please explain whats happeneing in back end..