Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi! I'm tring to calculate percentage of month based on Date range slicer on the dashboard.
Such as ;
November = 30 days
Date on slicer = 11/01/2022-11/15/2022
Percentage = 50%
If date range on slicer is 12/01/2022 - 12/19/2022 , then percentage = 61.29%
so this percentafe should change as Date slicer.
I've created Date table and add measure to count date of every month, but still cannot count date as slicer.
How should I do?
Solved! Go to Solution.
Hi @Anonymous
Please do the following steps: 2 seperate measures
1) Create last date measure (It will calculate last day of date selected like 30/31)
I hope I answered your question please give kudos and accept it as a solution!
Hi @Anonymous
Please do the following steps: 2 seperate measures
1) Create last date measure (It will calculate last day of date selected like 30/31)
I hope I answered your question please give kudos and accept it as a solution!
Hi @Anonymous
Did you try my solution???
If it helps please give kudos and accept it as a solution!
Hi, @Anonymous
Lets break down the solution into parts.
For days:
Calculate the days selected in the date range
TotalDays = COUNTROWS(DATESBETWEEN('Date Table'[Date], MIN('Date Table'[Date]), MAX('Date Table'[Date])))
calculate the number Of days in the month for the start date selected in a range.
DaysInMonth = CALCULATE(
COUNTROWS('Date Table'),
FILTER(
'Date Table',
MONTH('Date Table'[Date]) = MONTH(MIN('Date Table'[Date])) &&
YEAR('Date Table'[Date]) = YEAR(MIN('Date Table'[Date]))
)
)
calculate the percentage:
PercentageOfMonth = DIVIDE([TotalDays], [DaysInMonth])
Proud to be a Super User!
HI! @rubayatyasmin thank you for your reply
but as this
TotalDays = COUNTROWS(DATESBETWEEN('Date Table'[Date], MIN('Date Table'[Date]), MAX('Date Table'[Date])))
the result is still not change as date selected in a range. It's still count all date of the data, even I've only chosen 1 month.
Did you have any advice for this?
Thanks
can you provide a demo file?
Proud to be a Super User!
Sure
Hi @Anonymous
Did u try my answer ???
User | Count |
---|---|
84 | |
75 | |
69 | |
48 | |
39 |
User | Count |
---|---|
111 | |
56 | |
50 | |
42 | |
40 |