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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
harvis
Frequent Visitor

Calculate percentage og occurances before a hour and after a hour per. date

I would like to calculate the % of Id's in the table underneath that occures before Hour = 15 and after within each date.

 

In the example table underneath the Id 11111111 on date 24.05.2018 hour = 10 also have an occurence at 16 so the result of 24.05.2018 will therefore be 1/6 = 17%. 

 

Date                    Id                     Hour           UniqueId                 Count

24.05.201811111111101111111111
25.05.20181111111111111111112331
24.05.201822222222112222222211
24.05.201833333333113333333311
24.05.201844444444124444444411
24.05.201811111111161111111131
30.06.2018111111111011111111101
30.06.2018555555551155555555891
30.06.2018666666661366666666451
30.06.2018777777771477777777421

 

Appreciate it!

5 REPLIES 5
Floriankx
Solution Sage
Solution Sage

Hello,

 

You can use Measures like:

TotalCount=COUNTROWS(Table)
CountsBefore15=COUNTROWS(FILTER(Table,[Hour]<15))

Ratio=DIVIDE([CountrsBefore15],[TotalCount])

 

This should work if you group by Date and ID.

 

Best regards.

Thank you for the reply. This will give me a percetage for sure, but I need this to check for each Id. I need to check for each Id on each date if there is an occurence before 15 and after 15, and then calculate that percetage for each date.

Hello,

 

so please add Date and Id to row content of your PivotTable.

I need to be able to aggregate this up to month, so I can't be using Date and Id in pivot (Diagram)

Can you provide expected result as table?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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