Forum Discussion

RadhakrishnaE's avatar
RadhakrishnaE
Frequent Visitor
4 years ago
Solved

Need Dax for below logic

Hi All,

 

The table having below columns

 

ItemNoPriceType
LT1100Agency
LT150Executive
LT10Reprasentative
LT210Agency
LT220Executive
LT230Executive
LT270Reprasentative

 

Expecting result is; I am considering only Type "Reprasentative" and "Executive", And if there are two executives or representative need to add the price of then  "Reprasentative" or "Executive" individually.

ItemNoPriceAgency PricyType
LT150100Executive
LT25010Executive
LT27010Reprasentative

 

Thanks in advance.

  • Hi RadhakrishnaE ,

     

    Try this measure:

    Price 2 =
    IF(SUM('Table'[Price])=0,BLANK(),
    IF(SELECTEDVALUE('Table'[Type])="Executive"||SELECTEDVALUE('Table'[Type])="Reprasentative",SUM('Table'[Price]),BLANK()))
     
    Result:

     

    If I answered your question, please mark it as a solution to help other members find it more quickly.

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    RadhakrishnaE If I got you right you need simple measure like Sum_NoPrice=SUM(Table[NoPrice]). Then create visual table, drag on values 'Item', 'Sum_NoPrice', 'Type', and filter 'Type' field.

  • jppv20's avatar
    jppv20
    Icon for Solution Sage rankSolution Sage

    Hi RadhakrishnaE ,

     

    Try this measure:

    Price 2 =
    IF(SUM('Table'[Price])=0,BLANK(),
    IF(SELECTEDVALUE('Table'[Type])="Executive"||SELECTEDVALUE('Table'[Type])="Reprasentative",SUM('Table'[Price]),BLANK()))
     
    Result:

     

    If I answered your question, please mark it as a solution to help other members find it more quickly.

  • Samarth_18's avatar
    Samarth_18
    Icon for Community Champion rankCommunity Champion

    Hi RadhakrishnaE 

    You can use below measure:-

    Measure =
    VAR result =
        CALCULATE (
            SUM ( 'Table'[Price] ),
            FILTER ( 'Table', 'Table'[Type] IN { "Reprasentative", "Executive" } )
        )
    RETURN
        IF ( result = 0, BLANK (), result )

     

    Thanks,

    Samarth