Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi Folks,
I'm trying to create a measure based on this mathematical formula:
Measure = (Total Accounts Recievable in the Month * # of days in the given month) / Total Sales in the Month.
What I have so far:
Solved! Go to Solution.
Hi @GarlonYau
To count # of days per month
Days In Month = DAY(DATE(YEAR(T25[Date]),MONTH(T25[Date])+1,1)-1)
Cheers!
A
If you have a calendar table, a simply DISTINCTCOUNT can work.
Ex:
Days in quarter -->
Add a column to your date table.
Days in Q = VAR FirstDateVisible = CALCULATE ( MIN ( 'Date'[Date] ) ) VAR FirstYearVisible = YEAR ( FirstDateVisible ) VAR FirstQuarterVisible = QUOTIENT ( MONTH ( FirstDateVisible ) - 1, 3 ) VAR DaysInQuarter = FILTER ( ALL ( 'Date'[Date] ), YEAR ( 'Date'[Date] ) = FirstYearVisible && QUOTIENT ( MONTH ( 'Date'[Date] ) - 1, 3 ) = FirstQuarterVisible ) VAR FirstDayInQuarter = MINX ( DaysInQuarter, 'Date'[Date] ) VAR _Begin = CALCULATETABLE ( VALUES ( 'Date'[Date] ), 'Date'[Date] = FirstDayInQuarter ) VAR LastDateVisible = CALCULATE ( MAX ( 'Date'[Date] ) ) VAR LastYearVisible = YEAR ( LastDateVisible ) VAR LastQuarterVisible = QUOTIENT ( MONTH ( LastDateVisible ) - 1, 3 ) VAR LastDayInQuarter = MAXX ( DaysInQuarter, 'Date'[Date] ) VAR _End = CALCULATETABLE ( VALUES ( 'Date'[Date] ), 'Date'[Date] = LastDayInQuarter ) RETURN DATEDIFF(_Begin,_End,DAY)
How would I go about incorporating that into my existing equation?
Hi @GarlonYau
To count # of days per month
Days In Month = DAY(DATE(YEAR(T25[Date]),MONTH(T25[Date])+1,1)-1)
Cheers!
A
@Anonymous
I ended up getting it by using your new column!
Thank you so much!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
81 | |
79 | |
58 | |
35 | |
34 |
User | Count |
---|---|
99 | |
59 | |
56 | |
46 | |
40 |