Forum Discussion
Anonymous
3 years agoNot applicable
Using calculation in DAX while comparing
Hello guys,
I have this measure.
Focus Group = VAR TotWeeks = INT(1*(LASTDATE(Data[Order Create])-FIRSTDATE(Data[Order Create]))/7)+1
RETURN
IF([Quantity per Order]>500,3,
IF([Quantity per Order]<=500 && [Quantity per Order]>100 && COUNTA(Data[Sales Document])>=TotWeeks,2,
IF([Quantity per Order]<=500 && [Quantity per Order]>100 && COUNTA(Data[Sales Document])<TotWeeks,3,
IF([Quantity per Order]>=100 && COUNTA(Data[Sales Document])>=26,1,
IF([Quantity per Order]>=100 && COUNTA(Data[Sales Document])<26,2,3)))))
My TotWeeks variable is giving me the number of weeks between two dates that a user is selecting from a Date filter.
My TotWeeks variable is giving me the number of weeks between two dates that a user is selecting from a Date filter.
Now in the BOLD part above, I want to replace "26" by "TotWeeks/2", but whenever I do that, my tables start showing weird data.
With 26:
With 26:
With TotWeeks/2:
I have tried many things like putting INT(TotWeeks/2), or DIVIDE(TotWeeks/2), or ROUNDUP(TotWeeks/2,0) and none of them work. I have also tried looking at the results of these variations in a card value, and it shows up all good there. But just inside this measure I am not getting the correct value.
PLEASE HELP!
No Replies