cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SankeyThakkar_7
Helper II
Helper II

Value fetching in hierarchy type data

Dear Super Heroes,

Below is my sample data.

SankeyThakkar_7_0-1648622706225.png


I need Output like below,

SankeyThakkar_7_1-1648623165708.png

 

I created below measure, Which is working only when level 4 is there. If level 4 is not exist it will not showing my remaining values,

 

Below is my measure,

Measure =
IF(
MAX('Table'[Level4]) <> "",
IF(
ISINSCOPE('Table'[Level4]),
CALCULATE(SUM('Table'[Value])),
IF(
ISINSCOPE('Table'[Level3]),
CALCULATE(SUM('Table'[Value]),'Table'[Level4]=""),
IF(
ISINSCOPE('Table'[Level2]),
CALCULATE(SUM('Table'[Value]),'Table'[Level3]=""),
IF(
ISINSCOPE('Table'[Level1]),
CALCULATE(SUM('Table'[Value]),'Table'[Level2]=""),
BLANK()
)))))


After using measure below is my output coming,

SankeyThakkar_7_2-1648623365590.png

Kindly help please.





4 REPLIES 4
v-yangliu-msft
Community Support
Community Support

Hi  @SankeyThakkar_7 ,

Here are the steps you can follow:

1. According to the selected column – Transform – Unpivot Columns.

vyangliumsft_0-1649072959611.png

Result:

vyangliumsft_1-1649072959613.png

2. Create measure.

Measure =
var _a = CALCULATE(MAX('Table'[Value.1]),FILTER('Table',NOT(ISBLANK([Value.1]))))
return
if(_a in CALCULATETABLE(VALUES('Table'[Value.1]),FILTER(ALL('Table'),[Attribute]="Lev3")),_a)
Measure 3 =
var _a = CALCULATE(MAX('Table'[Value.1]),FILTER('Table',NOT(ISBLANK([Value.1]))))
return
if(_a in CALCULATETABLE(VALUES('Table'[Value.1]),FILTER(ALL('Table'),[Attribute]="Lev1")),_a)
Measure 4 = var _a = CALCULATE(MAX('Table'[Value.1]),FILTER('Table',NOT(ISBLANK([Value.1]))))
return
if(_a in CALCULATETABLE(VALUES('Table'[Value.1]),FILTER(ALL('Table'),[Attribute]="Lev2")),_a)
Measure 5 = var _a = CALCULATE(MAX('Table'[Value.1]),FILTER('Table',NOT(ISBLANK([Value.1]))))
return
if(_a in CALCULATETABLE(VALUES('Table'[Value.1]),FILTER(ALL('Table'),[Attribute]="Lev4")),_a)
For reference =
calculate(MAX('Table'[Attribute]),FILTER('Table',NOT(ISBLANK([Value.1]))))

3. Result:

vyangliumsft_2-1649072959613.png

Please click here for the pbix file

 

Best Regards,

Liu Yang

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

Thanks for help. I loose hope as no one is replying.

This solution has 2 major issues sir,

(1) Need to show in matrix so heirarchy is required.(ig level 4 iteam J is coming under what level of 1 ,2 and 3.
(2) If i applied this solution it increases row size very much.(if i have 500 rows as normal data set it will become 4500) So my actual data size is too much.

SankeyThakkar_7
Helper II
Helper II

No solution?

 

Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors
Top Kudoed Authors