The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi all,
I am trying to calculate days until next quarter from current date, I have used the 'Quarter' and 'today' function to get the current quarter. How do I count the number of days from current date to the beginning of next quarter.
example: today is 3/26/2020; so, I want to get the value 5. since, there are 5 days until quarter 2 of the year 2020. Thank you.
Kind Regards,
Shlok Shah
Solved! Go to Solution.
I do not have any date columns that I could depend on for using DAX in built quarter functions...
Here's how I did it(the harder way)
Current quarter = ROUNDUP(MONTH(TODAY()) / 3,0 )
First month in quarter = ([Current quarter]*3)-2
First day of the quarter = DATE(YEAR(TODAY()),[First month in quarter],1)
Days since first day of Quarter = DATEDIFF([First day of the quarter],TODAY(),DAY)
Last month of current quarter = ([Current quarter]*3)
Last day of current quarter = EOMONTH([First day of current quarter],2)
Total days in current quarter = DATEDIFF([First day of current quarter],[Last day of current quarter],DAY)
Days until next quarter = CALCULATE([Total days in current quarter]-[Days since first day of Quarter])
I do not have any date columns that I could depend on for using DAX in built quarter functions...
Here's how I did it(the harder way)
Current quarter = ROUNDUP(MONTH(TODAY()) / 3,0 )
First month in quarter = ([Current quarter]*3)-2
First day of the quarter = DATE(YEAR(TODAY()),[First month in quarter],1)
Days since first day of Quarter = DATEDIFF([First day of the quarter],TODAY(),DAY)
Last month of current quarter = ([Current quarter]*3)
Last day of current quarter = EOMONTH([First day of current quarter],2)
Total days in current quarter = DATEDIFF([First day of current quarter],[Last day of current quarter],DAY)
Days until next quarter = CALCULATE([Total days in current quarter]-[Days since first day of Quarter])
User | Count |
---|---|
15 | |
8 | |
6 | |
6 | |
6 |
User | Count |
---|---|
24 | |
14 | |
13 | |
8 | |
8 |