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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
MarcinJan
Frequent Visitor

Show max values of measure in hierarchy

Hi All

I have a usage table:

DateUserColumnComponentColumn
1:00 01/03/2021User1Component1
1:00 01/03/2021User2Component1
1:00 01/03/2021User3Component1
1:05 01/03/2021User1Component1
1:05 01/03/2021User4Component1
1:05 01/03/2021User5Component1
1:05 01/03/2021User6Component1
2:00 01/03/2021User7Component1

 

That gives us:

Day 1, Hour 1, Minute 00 - 3 distinct users;

Day 1, Hour 1, Minute 05 - 4 distinct users;

Day 1, Hour 2, Minute 00 - 1 distinct user;

Day 1, Hour 1 - 6 distinct users;

Day 1 - 7 distinct users;

 

But I wish to see a matrix, where I can see the distinct count on minute hierarchy level, wheras on hours and days hierarchy the max of minutes hierarchy. So:

 

Day 1, Hour 1, Minute 00 - 3 distinct users;

Day 1, Hour 1, Minute 05 - 4 distinct users;

Day 1, Hour 2, Minute 00 - 1 distinct user;

Day 1, Hour 1 - 4 distinct users;

Day 1 - 4 distinct users;

 

Now you see the difference ? on Hour and day level ?

I tried  several measures, GROUPBY, FILTERING but nothing works. I have to also filter Components. DISTINCTCOUNTS always adjusts to the hierarchy level and I did not fiugure out how to pass the value using MAXX. Any ideas how should I approach it ?

3 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi, @MarcinJan 

 

Please kindly check the below picture and the sample pbix file's link down below, whether it is what you are looking for.

 

Picture1.png

 

DistinctCount Users max of minute hierarchy =
VAR newtable =
SUMMARIZE (
ALL ( Times ),
Times[Minute Label],
"@distinctcount", DISTINCTCOUNT ( Data[UserColumn] )
)
RETURN
IF (
ISBLANK ( DISTINCTCOUNT ( Data[UserColumn] ) ),
BLANK (),
IF (
ISFILTERED ( Times[Minute Label] ),
DISTINCTCOUNT ( Data[UserColumn] ),
MAXX ( newtable, [@distinctcount] )
)
)

 

 

https://www.dropbox.com/s/i5ciuyw0kbldh5d/marcinjan.pbix?dl=0 

 

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

Jihwan Kim,

 

When used it with real data, the amounts do not look correct even the proper relationships are in place. Distinct Count is your measue, Count of User Column is distinct count of users. This 17 seems to count entire TIme span..

 

MarcinJan_0-1617796794998.png

 

View solution in original post

Hi @MarcinJan ,

Try the following formula:

Measure = 
MAXX(
    SUMMARIZE(
        'Table',
        'Table'[ComponentColumn],
        'Table'[Date/time],
        "_count",
        DISTINCTCOUNT('Table'[UserColumn])
    ),
    [_count]
)

 image.png

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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

View solution in original post

4 REPLIES 4
MarcinJan
Frequent Visitor

I eventually managed to use the blend of 2 replies above. The temp table really increases the performance of the app.

Jihwan_Kim
Super User
Super User

Hi, @MarcinJan 

 

Please kindly check the below picture and the sample pbix file's link down below, whether it is what you are looking for.

 

Picture1.png

 

DistinctCount Users max of minute hierarchy =
VAR newtable =
SUMMARIZE (
ALL ( Times ),
Times[Minute Label],
"@distinctcount", DISTINCTCOUNT ( Data[UserColumn] )
)
RETURN
IF (
ISBLANK ( DISTINCTCOUNT ( Data[UserColumn] ) ),
BLANK (),
IF (
ISFILTERED ( Times[Minute Label] ),
DISTINCTCOUNT ( Data[UserColumn] ),
MAXX ( newtable, [@distinctcount] )
)
)

 

 

https://www.dropbox.com/s/i5ciuyw0kbldh5d/marcinjan.pbix?dl=0 

 

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Jihwan Kim,

 

When used it with real data, the amounts do not look correct even the proper relationships are in place. Distinct Count is your measue, Count of User Column is distinct count of users. This 17 seems to count entire TIme span..

 

MarcinJan_0-1617796794998.png

 

Hi @MarcinJan ,

Try the following formula:

Measure = 
MAXX(
    SUMMARIZE(
        'Table',
        'Table'[ComponentColumn],
        'Table'[Date/time],
        "_count",
        DISTINCTCOUNT('Table'[UserColumn])
    ),
    [_count]
)

 image.png

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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

Helpful resources

Announcements
Fabcon_Europe_Social_Bogo

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.