Forum Discussion
Relationship between static values and date values (relationships between tables may be needed)
- 5 years ago
Hi, @
According to your description, I think you can use measure and slicer in Power BI to achieve your requirement, you can try this method:
- Create a calender table to get the data across 5 years:
Date = CALENDAR(DATE(2021,1,1),DATE(2025,12,31))- Create these calculated columns in the date table:
Month = FORMAT([Date],"mmm")Month-Year = [Month]&"-"&RIGHT(YEAR([Date]),2)Month-Year1 = YEAR([Date])&FORMAT([Date],"mm")Is Working Day = IF(WEEKDAY([Date],2)>5,0,1)Then sort the column [Month-Year] like this to make it ordered in the slicer:
- Create a measure:
Sum of working days = SUMX(ALLSELECTED('Date'),[Is Working Day])- Create a slicer to place [Month-Year] and a card chart to place the measure:
And you can get what you want.
You can download my test pbix file here
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for the replies everybody. I see now I wasn't as clear as I should have been in describing the problem.
So I have the table I showed previously:
| Name | Availability | Utilisation Target | Cost Rate |
| Chris | 1 | 0.90 | 100 |
| John | 0.5 | 0.90 | 125 |
| Peter | 0.8 | 0.70 | 85 |
And I also have a date table that looks like this:
| Date | Year | Month Number | Month-Year | Month-Year Sort | Is Working Day? |
| 01/01/2021 | 2021 | 1 | Jan-21 | 2021001 | 0 |
| 02/01/2021 | 2021 | 1 | Jan-21 | 2021001 | 0 |
| 03/01/2021 | 2021 | 1 | Jan-21 | 2021001 | 0 |
| 04/01/2021 | 2021 | 1 | Jan-21 | 2021001 | 1 |
| FORMULA |
At the bottom of this table (which includes five years worth of dates) is the formula:
Available Working Days:=SUM([Is Working Day?])
This then allows me to figure out the total number of working days in a pivot table by selecting the Month-Year from the filter (or using the month-year in other ways but it's the filter I'm mostly interested in).
This all works but generates the warning message I referred to previously.
I hope this makes it a bit clearer.
Thanks a lot.
Chris