Forum Discussion

a1b1c1's avatar
a1b1c1
Icon for Advocate I rankAdvocate I
5 years ago
Solved

Equal to comparison between two measures

I know that it sounds like a beginner level problem, but being a seasoned Power BI guy I've ran into a quite weird scenario that upon comparing two measures, the equal to comparison is not working correctly. 

Here's the DAX: 

IF([Total Activities]=[Yearly Average of Activities],2) 
Context: I see that when these two values are infact equal, it does not return 2. 


Thanks for your help in advance.
MFelix mahoneypat parry2k amitchandak 
  • a1b1c1 

    Please supply some data to test and examples of when this does not work.  

    How are you calculating the 2 measures [Total Activities] and [Yearly Average of Activities] ?

    What data types are these measures?  By their naming I'd expect [Total Activities] to be Whole Number and  [Yearly Average of Activities] to be a Decimal?

    If so, could it be that the decimal is formatted to look like a whole number, thereby giving the impression that both measures are equal at times?

    Regards

    Phil

2 Replies

  • PhilipTreacy I found out partially it was due to formatting (decimal formatted as whole number), topped up with some filter context issues which I took care of. 
    Cheers mate. 🙂

  • a1b1c1 

    Please supply some data to test and examples of when this does not work.  

    How are you calculating the 2 measures [Total Activities] and [Yearly Average of Activities] ?

    What data types are these measures?  By their naming I'd expect [Total Activities] to be Whole Number and  [Yearly Average of Activities] to be a Decimal?

    If so, could it be that the decimal is formatted to look like a whole number, thereby giving the impression that both measures are equal at times?

    Regards

    Phil