Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
AmazingRandom
Helper I
Helper I

Count with data hierarchy occurrence

I have been asked to do a day and occurrence count, the only tricky thing about it is that it needs to look at a certain hierarchy it is the follwoing:

Manual black > manual red > model black > model red

So the highest hieararchy is manual black. Each one of them is a measure calculated in percentage of time. I'll create a table to hopefully give enough example data:

 

LocationManual BlackModel BlackManual RedModel RedGreen
ABC4%40%  56%
DEF1%4%10%5%

80%

GHI  51%10%39%
JKL 1% 60%39%

 

So, per the requirements, there should be the following in the counts:

2 days with manual black

1 day with manual red

1 day with model black.

 

To my understanding, an IF or SWITCH function may work, though how can I apply that to a hierarchy? 

2 REPLIES 2
v-cgao-msft
Community Support
Community Support

Hi @AmazingRandom ,

So, per the requirements, there should be the following in the counts:
2 days with manual black

1 day with manual red

1 day with model black.

It would be helpful if you could elaborate on the computational logic behind these results, thanks.
How to Get Your Question Answered Quickly - Microsoft Fabric Community

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

I'm not sure I understand your question. The results are just an example. I asume you meant how they are calculated. 

 

They are calculated by a Divide formula, where it gets values from three columns. An overflow column, which says if it is overflown (automatic black) or green. 

 

A manual status column, whether it is defined as red manual, black manual or none (green).

 

Then a system model where it will show if it is a predicted red or green.

 

Then the measures divide the instances on each based the number of rows by the total rows, some conditions are applied to avoid overlapping and match the hierarchy. 

 

I hope I made sense to you explaining it

 

 

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.