Forum Discussion
measure question
Hi NM2023 ,
Based on your description and the dax expression provided, the metrics not displaying totals as expected may be due to the way the function is used in conjunction with the function. The function creates a context that is limited to the current row (opportunity ID in this case) and your measure will correctly calculate the revenue for each opportunity ID. However, for totals, Power BI tries to evaluate your measures in a different context, in which case the row context provided by Power BI is not directly applicable. To modify your first measure so that it displays results at both the row and total levels, you might consider adjusting the method used to ensure that the entire dataset is correctly summarized when calculating totals.
Revised version:
M_TotalRev_PertainingToOpty =
SUMX(
VALUES(Opportunity[ID]),
VAR Acct = SELECTEDVALUE(Opportunity[AcctNum])
VAR OptyProd = SELECTEDVALUE(Opportunity[Prod])
RETURN
CALCULATE(
[M_totalRev],
FILTER(
ALL(Sales),
Sales[AcctNum] = Acct && Sales[Prod] = OptyProd
)
)
)
If the above expression does not achieve your result, please provide the pbix file and hide the sensitive information in advance so that we can better help you.
Best regards,
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly