Forum Discussion

MrMP's avatar
MrMP
Helper III
6 years ago
Solved

Measure totals incorect using IF

Hello everyone,

 

I saw this issue many times, but I just cant seem to fix it.

 

I am working with sales data (Product hierarchy, customers, Locations etc). Currently model has 2 calendars. One active and second inactive used to compare two time periods.

 

The main issue is measure that has IF statement inside and where totals arent working.

measure = IF(OR(price using calendar 1=0,price using calendar 2=0),
0,
(price from calendar 1-price from calendar 2)*quantity from calendar 1.

 

Measure from calendar 2 is using USERELATIONSHIP and works well.

When I use data in tables, it gives me good data per row. The problem is with totals and I just cant seem to find a workaround for IF.

Thank you!

 

 

 

  • Hi MrMP 

     

    You might try something like :

    CALCBF_New =
    VAR _table =
        SUMMARIZE ( Table1, Table1[column], "_Value", [measure] )
    RETURN
        IF ( HASONEVALUE ( Table1[column] ), [measure], SUMX ( _table, [_Value] ) )

     

4 Replies