Forum Discussion
Dax - IF statement comparing two measures
Nope, it's a measure... created with a right click 'create measure' and defined as this:
And for my other two... sure - here are they definations. These are also measures.
Shipped Sales $:=sum(Sales[Shipped Dollars Column])
Shipped MSRP:=sum(Sales[Shipped MSRP Column])
Ran into almost this exact scenario, and have been left scratching my head. Seems like somehow the simple use of an operator [measure1] < [measure2] is somehow forcing a row context, and resulting in a cross join between the tables included in the visual.
In my case, I boiled it down to see what was happening, and eliminated the IF statement entirely. I would expect [measure1] < [measure2] to return a TRUE or FALSE (and it does), but it causes the crossjoin.
The only workaround I found was like yours - filter out junk rows by looking for blanks just before returning result, but I'd really like to understand WHY this is happening.
Were you able to find a better explanation? This thread looks un-resolved.
- Anonymous6 years agoNot applicable
Hello, I had the same problem as I wanted to create a measure by comparing two measures. Calculation was a never-ending process in the visualization, as I think if a scalar function is applied then PBI wants to do a cross join for all affected tables involved for the measure on the data model.
What I tried was:
Add a column on the dimensional table. Formula was IF(Measure1 = 0; Measure2; Measure1). It calculated all the values on row level, and it was working on the visuals.