Skip to main content
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Not 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
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.
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 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.




Helpful resources

Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City


Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors