Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Division for selected values in measure

Hi all,

 

I'm trying to division between two calculated measures . Below two columns are calculated measures 

measure1            measure2

0.93                            1.036

0.154                          0.570

0.00                            0.094

0.00                            0.339

 

Here is the output I need in one measure i.e 1.036/0.93,0.570/0.154,0.094/0.154,0.339/0.154 .

 

please help me out

  • Hi Anonymous ,

     

    You can try to create measures like DAX below

     

    Measure 1_noblank =

    var _lastmeasure=CALCULATE(MAX(Table1[Index]),FILTER(ALL(Table1),Table1[Index]<MAX(Table1[Index])&&[Measure 1]<>0))

    return

    IF([Measure 1]=0,CALCULATE([Measure 1],FILTER(ALL(Table1),Table1[Index]=_lastmeasure)),[Measure 1])

     

    Divide = DIVIDE(Table1[Measure 2],Table1[Measure 1_noblank])

     

    Best Regards,

    Amy

     

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

1 Reply

  • v-xicai's avatar
    v-xicai
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    You can try to create measures like DAX below

     

    Measure 1_noblank =

    var _lastmeasure=CALCULATE(MAX(Table1[Index]),FILTER(ALL(Table1),Table1[Index]<MAX(Table1[Index])&&[Measure 1]<>0))

    return

    IF([Measure 1]=0,CALCULATE([Measure 1],FILTER(ALL(Table1),Table1[Index]=_lastmeasure)),[Measure 1])

     

    Divide = DIVIDE(Table1[Measure 2],Table1[Measure 1_noblank])

     

    Best Regards,

    Amy

     

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