Forum Discussion

Glory1891's avatar
Glory1891
New Member
2 years ago
Solved

Help Dax

Hi everyone,   In Power Bi I created 3 pie charts. The 1st contains data from 2018, the 2nd data from 2019 and the 3rd the data from 2018 and 2019 combined. I would like to calculate the differen...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Glory1891 ,

    Below is my 2019 table:

    Below is my 2018 table:

    First , you need to configure the relationship for the two tables:

    The following DAX might work for you:

    Measure = 
       var p_2018 = SELECTEDVALUE('2018'[Som value])
       var p_2019 = SELECTEDVALUE('2019'[Som value])
       var result = 
           CALCULATE(
             p_2019 - p_2018,
             ALL('2018'[Product])
           )
        return result
    

    The final output is shown in the following figure:

    Best Regards,

    Xianda Tang

    If this post helps , then please consider Accept it as the solution to help the other members find it more quickly.