Forum Discussion

jananagarajan's avatar
jananagarajan
Regular Visitor
3 years ago
Solved

How to write a logical if statement for the index

How to write a logical if statement for the index 

Have written the same calculation in excel and would like to write the same in DAX

IF(C3<>"",C3/$C$3,"")

 

Sample Data is attached

 

Customer IDTempValueCalculation
T023555 
T032750100%
T06294998%
T01334896%
T04284794%
T05274692%
T01354590%
T02264488%
T03344386%
T01314182%
T05314080%
T01313978%
T02313876%
T06353774%
T04263672%
T05283468%
T02333264%
T01263162%
T03283060%
T02323060%
  • Hi,

    I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

    It is for creating a new column.

     

     

     

    Calculation CC =
    VAR _fixvalue =
        SUMX (
            FILTER ( Data, Data[Customer ID] = "T03" && Data[Temp] = 27 ),
            Data[Value]
        )
    VAR _result =
        DIVIDE ( Data[Value], _fixvalue )
    RETURN
        IF ( _result > 1, BLANK (), FORMAT ( _result, "#0.0%" ) )
    

     

3 Replies

  • Hi,

    I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

    It is for creating a new column.

     

     

     

    Calculation CC =
    VAR _fixvalue =
        SUMX (
            FILTER ( Data, Data[Customer ID] = "T03" && Data[Temp] = 27 ),
            Data[Value]
        )
    VAR _result =
        DIVIDE ( Data[Value], _fixvalue )
    RETURN
        IF ( _result > 1, BLANK (), FORMAT ( _result, "#0.0%" ) )