Forum Discussion
Data Prep in Power Bi for Operational Dashboard
Hi Super Users,
I having some dillema with this data. If I have the following data, reported of the counts on a weekly basis (Fridays of each week):
| Total | Active | Inactive | Performance | Value / Percentage | Date | Asset Name | Category Type |
| 60 | 52 | 9 | 87% | 52 / 60 (87%) | 6/12/2024 | Device Light A | Lighting |
| 14 | 10 | 3 | 71% | 10 / 14 (71%) | 6/12/2024 | Device Light B | Lighting |
| 24 | 18 | 4 | 75% | 18 / 24 (75%) | 6/12/2024 | Device Light C | Lighting |
| 20 | 4 | 16 | 20% | 4 / 20 (20%) | 6/12/2024 | Device Light E | Lighting |
| 46 | 36 | 10 | 78% | 36 / 46 (78%) | 6/12/2024 | Device Light F | Lighting |
| 11 | 7 | 0 | 64% | 7 / 11 (64%) | 6/12/2024 | Device Light G | Lighting |
| 175 | 127 | 42 | 73% | 127 / 175 (73%) | 6/12/2024 | Total to date | Lighting |
| 60 | 52 | 8 | 87% | 52 / 60 (87%) | 13/12/2024 | Device Light A | Lighting |
| 14 | 11 | 3 | 79% | 11 / 14 (79%) | 13/12/2024 | Device Light B | Lighting |
| 24 | 18 | 6 | 75% | 18 / 24 (75%) | 13/12/2024 | Device Light C | Lighting |
| 20 | 4 | 16 | 20% | 4 / 20 (20%) | 13/12/2024 | Device Light E | Lighting |
| 46 | 36 | 10 | 78% | 36 / 46 (78%) | 13/12/2024 | Device Light F | Lighting |
| 11 | 7 | 4 | 64% | 7 / 11 (64%) | 13/12/2024 | Device Light G | Lighting |
| 175 | 128 | 47 | 73% | 128 / 175 (73%) | 13/12/2024 | Light Total to date | Lighting |
| 60 | 52 | 7 | 87% | 52 / 60 (87%) | 20/12/2024 | Device Light A | Lighting |
| 14 | 11 | 3 | 79% | 11 / 14 (79%) | 20/12/2024 | Device Light B | Lighting |
| 24 | 18 | 6 | 75% | 18 / 24 (75%) | 20/12/2024 | Device Light C | Lighting |
| 20 | 4 | 16 | 20% | 4 / 20 (20%) | 20/12/2024 | Device Light E | Lighting |
| 46 | 36 | 10 | 78% | 36 / 46 (78%) | 20/12/2024 | Device Light F | Lighting |
| 11 | 8 | 1 | 73% | 8 / 11 (73%) | 20/12/2024 | Device Light G | Lighting |
| 175 | 129 | 43 | 74% | 129 / 175 (74%) | 20/12/2024 | Light Total to date | Lighting |
| 60 | 52 | 7 | 87% | 52 / 60 (87%) | 27/12/2024 | Device Light A | Lighting |
| 14 | 11 | 3 | 79% | 11 / 14 (79%) | 27/12/2024 | Device Light B | Lighting |
| 24 | 18 | 6 | 75% | 18 / 24 (75%) | 27/12/2024 | Device Light C | Lighting |
| 20 | 4 | 16 | 20% | 4 / 20 (20%) | 27/12/2024 | Device Light E | Lighting |
| 46 | 36 | 10 | 78% | 36 / 46 (78%) | 27/12/2024 | Device Light F | Lighting |
| 11 | 8 | 1 | 73% | 8 / 11 (73%) | 20/12/2024 | Device Light G | Lighting |
| 175 | 129 | 43 | 74% | 129 / 175 (74%) | 20/12/2024 | Light Total to date | Lighting |
| 12 | 12 | 0 | 100% | 12 / 12 (100%) | 6/12/2024 | Device Door A | Door |
| 9 | 6 | 3 | 67% | 6 / 9 (67%) | 6/12/2024 | Device Door B | Door |
| 14 | 14 | 0 | 100% | 14 / 14 (100%) | 6/12/2024 | Device Door C | Door |
| 6 | 6 | 6 | 100% | 6 / 6 (100%) | 6/12/2024 | Device Door E | Door |
| 4 | 1 | 3 | 25% | 1 / 4 (25%) | 6/12/2024 | Device Door F | Door |
| 45 | 39 | 12 | 78% | 39 / 45 (78%) | 6/12/2024 | Total to date | Door |
| 12 | 12 | 0 | 100% | 12 / 12 (100%) | 13/12/2024 | Device Door A | Door |
| 9 | 6 | 3 | 67% | 6 / 9 (67%) | 13/12/2024 | Device Door B | Door |
| 14 | 12 | 2 | 86% | 12 / 14 (86%) | 13/12/2024 | Device Door C | Door |
| 6 | 6 | 6 | 100% | 6 / 6 (100%) | 13/12/2024 | Device Door E | Door |
| 4 | 1 | 3 | 25% | 1 / 4 (25%) | 13/12/2024 | Device Door F | Door |
| 45 | 37 | 14 | 75% | 37 / 45 (75%) | 13/12/2024 | Total to date | Door |
| 12 | 12 | 0 | 100% | 12 / 12 (100%) | 20/12/2024 | Device Door A | Door |
| 9 | 6 | 3 | 67% | 6 / 9 (67%) | 20/12/2024 | Device Door B | Door |
| 14 | 14 | 0 | 100% | 14 / 14 (100%) | 20/12/2024 | Device Door C | Door |
| 6 | 0 | 6 | 0% | 0 / 6 (0%) | 20/12/2024 | Device Door E | Door |
| 4 | 1 | 3 | 25% | 1 / 4 (25%) | 20/12/2024 | Device Door F | Door |
| 45 | 33 | 12 | 58% | 33 / 45 (58%) | 20/12/2024 | Total to date | Door |
| 12 | 12 | 0 | 100% | 12 / 12 (100%) | 27/12/2024 | Device Door A | Door |
| 9 | 7 | 2 | 78% | 7 / 9 (78%) | 27/12/2024 | Device Door B | Door |
| 14 | 14 | 0 | 100% | 14 / 14 (100%) | 27/12/2024 | Device Door C | Door |
| 6 | 0 | 6 | 0% | 0 / 6 (0%) | 27/12/2024 | Device Door E | Door |
| 4 | 3 | 1 | 75% | 3 / 4 (75%) | 27/12/2024 | Device Door F | Door |
| 45 | 36 | 9 | 71% | 36 / 45 (71%) | 27/12/2024 | Total to date | Door |
The data is based on 'reported date' which is weekly on the Fridays.
1) What would be the best methods to shows the counts from month to month, then week to week? Using distinct count seems to only counts the rows of distinct asset, but could not count the value on each.
2) How do I show the total of devices without totalling all the number of the devices?
3) How do I shows interaction between month? then week?
4) How to join with Commentary data which only have monthly comments?
Any good link or suggestion of using DateTable. Could you please shine some light of resolving this? Many thanks.
9 Replies
- parry2k
Super User
ketay for the date table, take a look at the playlist on my YT channel:
As a best practice, add a date dimension in your model and use it for time intelligence calculations. Once the date dimension is added, mark it as a date table on table tools. Check the related videos on my YT channel
Add Date Dimension
Importance of Date Dimension
Mark date dimension as a date table - why and how?
Time Intelligence Playlist- ketayFrequent Visitor
Thanks for the reply parry2k. I will adpot the date table and make use of it.
Do you have any recommendation towards displaying the total active and total inactive per category and per item? If I use distinct count seems to only counts the rows of distinct asset, but could not count the value on each.
- ketayFrequent Visitor
Thanks for the reply.
I'll try my best to explain more. So, each row is recording the weekly counts, for example, it reports on the Category = Lighting and Asset Name = Device A, B, C and etc on 6/12/2024, with:Total = Total Asset count
Active = Total Active count
Inactive = Total Inactive count
And get repeats on the next week...and so forth.
My challenge is when I sum the values, it returns the accumulated total of all the devices. What would be the best way to prep the data so that I can provide the actual counts across months, weeks and even days.
Appreciate any recommendation or tips to this. Thanks in advance.
Total Active Inactive Performance Value / Percentage Date Asset Name Category Type 60 52 9 87% 52 / 60
(87%)6/12/2024 Device Light A Lighting 14 10 3 71% 10 / 14
(71%)6/12/2024 Device Light B Lighting 24 18 4 75% 18 / 24
(75%)6/12/2024 Device Light C Lighting 20 4 16 20% 4 / 20
(20%)6/12/2024 Device Light E Lighting 46 36 10 78% 36 / 46
(78%)6/12/2024 Device Light F Lighting 11 7 0 64% 7 / 11
(64%)6/12/2024 Device Light G Lighting 175 127 42 73% 127 / 175
(73%)6/12/2024 Total to date Lighting
- v-sathmakuri
Community Support
Hi ketay ,
Thank you for reaching out to Microsoft Fabric Community.
Sorry for the delay in response.
Please use the below measures to get the expected results. Also attached the pbix file for reference.
Create a date table and establis relation ship with your table on date columns.
DateTable =ADDCOLUMNS (CALENDAR (DATE(2024, 1, 1), DATE(2025, 12, 31)),"Year", YEAR([Date]),"Month", FORMAT([Date], "MMMM"),"MonthNum", MONTH([Date]),"Week", WEEKNUM([Date]),"Week Ending", [Date] // since you use Friday as reporting)use below measure to create week rage from friday to thursdayWeekRange =VAR StartOfWeek =VAR d = [Date]VAR offset =SWITCH(WEEKDAY(d, 2),1, -3,2, -4,3, -5,4, -6,5, 0,6, -1,7, -2)RETURN d + offsetVAR EndOfWeek = StartOfWeek + 6RETURNFORMAT(StartOfWeek, "MMM d") & " ā " & FORMAT(EndOfWeek, "MMM d")Use below measures to calculate Total Asset count, Total Active count and Total Inactive countActive Devices (Latest Per Asset) =SUMX(VALUES('Table'[Asset Name]),VAR latestDate =CALCULATE(MAX('Table'[Date]))RETURNCALCULATE(MAX('Table'[Active]),'Table'[Date] = latestDate))Inactive Devices (Latest Per Asset) =SUMX(VALUES('Table'[Asset Name]),VAR latestDate =CALCULATE(MAX('Table'[Date]))RETURNCALCULATE(MAX('Table'[Inactive]),'Table'[Date] = latestDate))Total Devices (Latest Per Asset) =SUMX(VALUES('Table'[Asset Name]),VAR latestDate =CALCULATE(MAX('Table'[Date]))RETURNCALCULATE(MAX('Table'[Total]),'Table'[Date] = latestDate))If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" ā Iād truly appreciate it!