Forum Discussion
How to calculate Dynamic quarters
- 4 years ago
Hi Anonymous
try this, then put the measure into visual level filter
filterMeasure = VAR _currentMonth = 7 //replace it with month(today()) VAR _currentYear = 2022//replace it with year(today()) VAR _quarter = DIVIDE ( _currentMonth, 3 ) VAR _day = _quarter - QUOTIENT ( _currentMonth, 3 ) VAR _startDate = IF ( _currentMonth < 4, DATE ( _currentYear - 1, 1, 1 ), DATE ( _currentYear, 1, 1 ) ) VAR _endDate = SWITCH ( TRUE (), _currentMonth < 4, DATE ( _currentYear - 1, 12, 31 ), _day <> 0, DATE ( _currentYear, INT ( _quarter ) * 3 + 1, 1 ), _day = 0, DATE ( _currentYear, ( _quarter - 1 ) * 3 + 1, 1 ) ) RETURN IF(MIN('value'[date])<_endDate&&MIN('value'[date])>=_startDate,1,0)2021/10
2022/1
2022/7
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
Anonymous , I think you are having a year starting in April and you need YTD
With help from date table and time intelligence. Create Qtr column in calendar
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"3/31"))
refer if needed
Creating Financial Calendar - From Any Month
https://community.powerbi.com/t5/Community-Blog/Creating-Financial-Calendar-Decoding-Date-and-Calendar-1-5-Power/ba-p/1187441
Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA
- Anonymous4 years agoNot applicable
I have to show the quaters in columns like Q1 ,Q2,Q3,Q4 now it's Sept month means it comes in Q2 so my matrix will show only Q1 column and Q2 column in the next month Oct the Q3 will start then my matrix show the Q1,Q2,Q3 columns