Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Urgent help- Dax

Hey, Hope all of you are good.

 

Please find below data,

 

remarkreportdatelobgeographyassetclasssublobValue(int)
lob13-Dec-21Markets   1
lgas13-Dec-21MarketsDomesticEquityA2
lgas13-Dec-21MarketsDomesticEquityB3
lgas13-Dec-21MarketsDomesticEquityC4
lgas13-Dec-21MarketsDomesticEquityD5
lgas13-Dec-21MarketsDomesticEquityE6
lgas13-Dec-21MarketsDomesticEquityH7
lgas13-Dec-21MarketsDomesticEquityF8
lgas13-Dec-21MarketsDomesticEquityG9
lgas13-Dec-21MarketsInternationalEquityB1
lgas13-Dec-21MarketsDomesticCurrencyF2
lgas13-Dec-21MarketsDomesticCurrencyD3
lgas13-Dec-21MarketsInternationalCurrencyD4
lgas13-Dec-21MarketsInternationalEquityD5
lga13-Dec-21MarketsDomesticCurrency 6
lga13-Dec-21MarketsDomesticEquity 7
lga13-Dec-21MarketsInternationalEquity 8
lga13-Dec-21MarketsInternationalCurrency 9
lg13-Dec-21MarketsInternational  1
lg13-Dec-21MarketsDomestic  2

 

 

====>>>>Wrong Output coming,

hierarchy of matrix shown below,

 

 

1)

 

2)

 

3)

 

 

4)

 

 

 

 

 

I need output in hierarchy wise below, Kindly help asap.

 

1)

 

 

2)

 

3)

 

 

4)

 

 

Please Help MVP of Power Bi.....Super heroes of power bi

 

amitchandak 

AlexisOlson 

v-zhangti 

Anand24 

v-yalanwu-msft 

 

 

 

 

  • Hi, Anonymous 

    Try to create a measure like this:

    Measure = 
    var _t1=CALCULATE(SUM('Table'[Value(int)]),'Table'[sublob]=BLANK())
    var _t2=CALCULATE(SUM('Table'[Value(int)]),'Table'[sublob]=BLANK()&&'Table'[assetclass]=BLANK())
    var _t3=CALCULATE(SUM('Table'[Value(int)]),'Table'[sublob]=BLANK()&&'Table'[assetclass]=BLANK()&&'Table'[geography]=BLANK())
    var _t4=0  //whatever you want
    // CALCULATE(SUM('Table'[Value(int)]),'Table'[sublob]=BLANK()&&'Table'[assetclass]=BLANK()&&'Table'[geography]=BLANK()&&'Table'[lob]=BLANK())
    
    var _if=IF(
        ISINSCOPE( 'Table'[lob] ),
        IF(
            ISINSCOPE( 'Table'[geography] ),
            IF(
                ISINSCOPE( 'Table'[assetclass] ),
                IF( 
                    ISINSCOPE( 'Table'[sublob] ), 
                    SUM('Table'[Value(int)])// 0
                    , 
                    _t1// 1 
                    ),
                _t2// 2
            ),
            _t3// 3
        ),
        _t4// 4
    )
    return _if


    Result:

    Please refer to the attachment below for details. Hope this helps.

     

     

     

    Best Regards,
    Community Support Team _ Zeon Zheng


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

7 Replies

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

    Hi Anonymous ,

    To achive this, you can follow below steps:-

    1. Right click on lob column and select create a hierarchy:-

    2. Now you will see new hierarchy created

     

    3. Now right click on geograph column and click on add to hierarchy and add it lob hierarchy:-

    4.Follow the same step for asset class and sub lob. You will see below output

    5. Now add this hierachy into the matrix and put filter for non blank value in assetclass and sublob column

    Thanks,

    Samarth

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks, For your valuable time. Actually if you see my desire output . I required value as it is in total. In your solution I got value of category as subtotal(sum). Which is not correct solution. Kindly help. Not getting desired output from 5 day. Samarth_18  and amitchandak .

  • Anonymous's avatar
    Anonymous
    Not applicable

    No solution with you? Power bi Superheroes????? 😐

  • Hi, Anonymous 

    Try to create a measure like this:

    Measure = 
    var _t1=CALCULATE(SUM('Table'[Value(int)]),'Table'[sublob]=BLANK())
    var _t2=CALCULATE(SUM('Table'[Value(int)]),'Table'[sublob]=BLANK()&&'Table'[assetclass]=BLANK())
    var _t3=CALCULATE(SUM('Table'[Value(int)]),'Table'[sublob]=BLANK()&&'Table'[assetclass]=BLANK()&&'Table'[geography]=BLANK())
    var _t4=0  //whatever you want
    // CALCULATE(SUM('Table'[Value(int)]),'Table'[sublob]=BLANK()&&'Table'[assetclass]=BLANK()&&'Table'[geography]=BLANK()&&'Table'[lob]=BLANK())
    
    var _if=IF(
        ISINSCOPE( 'Table'[lob] ),
        IF(
            ISINSCOPE( 'Table'[geography] ),
            IF(
                ISINSCOPE( 'Table'[assetclass] ),
                IF( 
                    ISINSCOPE( 'Table'[sublob] ), 
                    SUM('Table'[Value(int)])// 0
                    , 
                    _t1// 1 
                    ),
                _t2// 2
            ),
            _t3// 3
        ),
        _t4// 4
    )
    return _if


    Result:

    Please refer to the attachment below for details. Hope this helps.

     

     

     

    Best Regards,
    Community Support Team _ Zeon Zheng


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

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks for detail replies