March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I am trying to do a quarter over quarter to date calculation. The current quarter to date isn't an issue. However, I am having an issue getting the previous QTD to work as I want. I have a slicer where users select the quarter they want to look at. When they select a previous quarter that is fine because the previousquarter formula is all I need. However, when looking at the current quarter we want to create a more accuracte comparison. If today is that start of the quarter it wouldn't be useful to compare one day to the entire previous quarter. Power BI does this because the entire quarter is selected in the slicer. Instead we would want to compare today to the first day of the previous quarter. Tomorrow we would want to compare the first 2 days of this quarter to first 2 of last.
Here is some sample data for a scenario.
Date | Amount |
1/1/2018 | 5 |
1/2/2018 | 3 |
2/3/2018 | 2 |
3/28/2018 | 1 |
4/1/2018 | 8 |
4/5/2018 | 6 |
6/12/2018 | 4 |
If today was 6/12/2018 we would want to get the sum of 1/1/2018-3/12/2018 so we could compare with our current quarter.
Qtr | QTD | Previous QTD |
2018Q2 | 18 | 10 |
if today was 6/30/2018, then we would want to compare 1/1/2018-3/31/2018 to the current quarter (4/1/2018 -6/30/2018).
Qtr | QTD | Previous QTD |
2018Q2 | 18 | 11 |
What is the best way to go about this?
Solved! Go to Solution.
I solved this by making a previous Qtr flag on the query editor on the date table then adding that as an additional filter in my measure.
=Table.AddColumn(#"Changed Type1", "Previous Qtr Flag", each if [Date] <= Date.AddMonths(Date.From(DateTime.LocalNow()),-3) then 1 else 0)
I solved this by making a previous Qtr flag on the query editor on the date table then adding that as an additional filter in my measure.
=Table.AddColumn(#"Changed Type1", "Previous Qtr Flag", each if [Date] <= Date.AddMonths(Date.From(DateTime.LocalNow()),-3) then 1 else 0)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
91 | |
74 | |
58 | |
53 |
User | Count |
---|---|
196 | |
115 | |
107 | |
66 | |
63 |