Forum Discussion

hbgv123's avatar
hbgv123
Frequent Visitor
2 years ago
Solved

DAX Measure based on multiple fields

Hi, 

I am trying structure my calculations using DAX and i cannot change my datamodel.

I need to calculate two measures

Rating Measure - this is calculated by considering sum of above/ sum of under from format column when setting is Rating

Target Measure- this is calculated by considering sum of above/ sum of under from format column when setting is Target

I achieved this calculation in powerquery but i wanted to use DAX for other reasons.

Can you help in providing tips to achieve these measures?

 

DateProductFormatSettingValue
Jan-23LuxAboveRating20
Jan-23LuxUnderRating30
Jan-23LuxAboveTarget30
Jan-23LuxUnderTarget40
Feb-23LuxAboveRating30
Feb-23LuxUnderRating40
Feb-23LuxAboveTarget40
Feb-23LuxUnderTarget50
Mar-23LuxAboveRating45
Mar-23LuxUnderRating45
Mar-23LuxAboveTarget40
Mar-23LuxUnderTarget50

 

 

Expected solution for rating and target measure:

 

 

Thanks for your help

  • Rating Measure=DIVIDE(CALCULATE(SUM(Data[Value]),Data[Format]="Rating",Data[Setting]="Above"),CALCULATE(SUM(Data[Value]),Data[Format]="Rating",Data[Setting]="Under"))

    Target Measure=DIVIDE(CALCULATE(SUM(Data[Value]),Data[Format]="Target",Data[Setting]="Above"),CALCULATE(SUM(Data[Value]),Data[Format]="Target",Data[Setting]="Under"))

1 Reply

  • wdx223_Daniel's avatar
    wdx223_Daniel
    Community Champion

    Rating Measure=DIVIDE(CALCULATE(SUM(Data[Value]),Data[Format]="Rating",Data[Setting]="Above"),CALCULATE(SUM(Data[Value]),Data[Format]="Rating",Data[Setting]="Under"))

    Target Measure=DIVIDE(CALCULATE(SUM(Data[Value]),Data[Format]="Target",Data[Setting]="Above"),CALCULATE(SUM(Data[Value]),Data[Format]="Target",Data[Setting]="Under"))