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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

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.



Microsoft MVP



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.




LinkedInVisit my LinkedIn page




Outlook BookingSchedule a short Teams meeting to discuss your question





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.



Microsoft MVP



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.




LinkedInVisit my LinkedIn page




Outlook BookingSchedule a short Teams meeting to discuss your question





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
May PBI 25 Carousel

Power BI Monthly Update - May 2025

Check out the May 2025 Power BI update to learn about new features.

May 2025 Monthly Update

Fabric Community Update - May 2025

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