Forum Discussion

aishak12's avatar
aishak12
Icon for Helper IV rankHelper IV
4 years ago
Solved

Two Conditions in IF Statement

Hello, 

 

I have three columns 

 

Column A

Column B

Column C

I would like to create a IF Formula with the following statements:

 

IF(Query1[Column B] < 40 = Query1[ColumnA]
IF Query1[Column B] > 40 = 40
IF Column C = "PAN" = 45 

 

How can I create that as a measure? 

  • Hi aishak12 

     

    For measure:

     

    IF (
        SELECTEDVALUE ( 'Table'[Column C] ) = "PAN", 45 ,
        IF ( SUM ( 'Table'[Column B] ) < 40, SUM ( 'Table'[Coulumn A] ), 40 )
    )
    

     

    For calcualte colum:

     

    IF ( [Column C] = "PAN", 45, IF ( [Column B] < 40, [ColumnA], 40 ) )
    

     

     

    Pbix in the end you can refer.

    Best Regards

    Community Support Team _ chenwu zhu

     

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

2 Replies

  • aishak12 , Try like

    Sumx(Query1,
    Switch(True() ,
    Query1[Column B] < 40 ,Query1[ColumnA],
    Query1[Column B] > 40 , 40,
    Query1[Column C] = "PAN" , 45
    ))

     

     

  • v-chenwuz-msft's avatar
    v-chenwuz-msft
    Icon for Community Support rankCommunity Support

    Hi aishak12 

     

    For measure:

     

    IF (
        SELECTEDVALUE ( 'Table'[Column C] ) = "PAN", 45 ,
        IF ( SUM ( 'Table'[Column B] ) < 40, SUM ( 'Table'[Coulumn A] ), 40 )
    )
    

     

    For calcualte colum:

     

    IF ( [Column C] = "PAN", 45, IF ( [Column B] < 40, [ColumnA], 40 ) )
    

     

     

    Pbix in the end you can refer.

    Best Regards

    Community Support Team _ chenwu zhu

     

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