Forum Discussion
Compare Data within the same table
Hi tonijj,
It seems like I only add 'host name' filter on previous total variable,now I add it to current total variable, maybe you can try ot use following formula if it fix the issue.
MOM Diff =
VAR currDate =
MAX ( DateTable[DateKey] )
VAR currTotal =
CALCULATE (
SUM ( DetailedVolumes[Volume] ),
FILTER (
ALLSELECTED ( DetailedVolumes ),
MONTH ( [DateKey] ) = MONTH ( currDate )
),
VALUES ( Services[SIN] ),
VALUES ( Service[Host Name] )
)
VAR prevTotal =
CALCULATE (
SUM ( DetailedVolumes[Volume] ),
FILTER (
ALLSELECTED ( DetailedVolumes ),
MONTH ( [DateKey] )
= MONTH ( currDate ) - 1
),
VALUES ( Services[SIN] ),
VALUES ( Service[Host Name] )
)
RETURN
IF ( prevtotal <> BLANK (), currTotal - prevTotal )
BTW, 'all' function will ignore other filter effects, so I use 'allselected' function to instead.(it can also break current row contents filter but not ignore other filters)
Regards,
Xiaoxin Sheng
Anonymous
Hi,
I actually did try to add that line to the formula, but it didnt work. Well, except for that the "hostname" is in the table "Detailedvolume". In any case, I get the same result, it leaves the "MOM Diff" blank even though there is a difference, but only on hostname level.
If the formula would calculate on that level as well Im pretty sure the Totals would be fine. Any other suggestions?
Ps. Of course youre right about the "ALL" function, thanks for the explanation, think I was just too tired when I tried that out last week :) Appreciate the explanation!
- Anonymous7 years agoNot applicable
Hi tonijj,
Yes, measure with specific filters has some trouble to calculate on total level, maybe you can take a look at following blog which told about hierarchy level handling.
Clever Hierarchy Handling in DAX
Regards,
Xiaoxin Sheng