locked
SSAS Tabular Calculation RRS feed

  • Question

  • Hi,

    I am using ssas 2014 tabular in which I have a cost measure based on a location.

    Ex

    || Location || Cost ||
    | abc_India | 20 |
    | final_india | 20 |
    | bcd_china | 20 |
    | final_china | 20 |

    Basically cost is same for all the location which will be used as a dimension.

    Now the requirement is to show final_india+final_china this is 40 by default as measure value but it should split in 4 values if I am dragging location in columns.

    EX

    COST=40 when i am not using location dimension

    but when i am using location attribute in column it should slipt as

    || Location || Cost ||
    | abc_India | 20 |
    | final_india | 20 |
    | bcd_china | 20 |
    | final_china | 20 |

    Monday, October 8, 2018 2:15 PM

Answers

  • Hi Mukul Pratap sengar,

    Please have a try following Dax expression:

    Measure = IF(ISBLANK(SELECTEDVALUE(Dim_Location[Location]))=FALSE(),SUMX(Fact_Cost,Fact_Cost[Cost]),CALCULATE(SUM(Fact_Cost[Cost]),(Dim_Location[Location]="final_india")||(Dim_Location[Location]="final_china")))


    Regards,

    Pirlo Zhang 


    MSDN Community Support<br/> Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact <a href="mailto:MSDNFSF@microsoft.com">MSDNFSF@microsoft.com</a>.


    Wednesday, October 10, 2018 6:50 AM

All replies

  • Hi Mukul Pratap sengar,

    Please have a try following Dax expression:

    Measure = IF(ISBLANK(SELECTEDVALUE(Dim_Location[Location]))=FALSE(),SUMX(Fact_Cost,Fact_Cost[Cost]),CALCULATE(SUM(Fact_Cost[Cost]),(Dim_Location[Location]="final_india")||(Dim_Location[Location]="final_china")))


    Regards,

    Pirlo Zhang 


    MSDN Community Support<br/> Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact <a href="mailto:MSDNFSF@microsoft.com">MSDNFSF@microsoft.com</a>.


    Wednesday, October 10, 2018 6:50 AM
  • Thanks Pirlo, it worked
    Wednesday, October 10, 2018 8:38 AM