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
Hi All-
Im looking to calculate change between Current year Qtr1 and previous year Qtr4. Thank you
Solved! Go to Solution.
Hi @RilwanFlame ,
Try to use DATEADD function like so:
Difference =
VAR PreQuar_ =
CALCULATE ( SUM ( 'Table'[Value] ), DATEADD ( 'Table'[Date], -1, QUARTER ) )
VAR ThisQuar_ =
SUM ( 'Table'[Value] )
RETURN
ThisQuar_ - PreQuar_
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @RilwanFlame ,
Try to use DATEADD function like so:
Difference =
VAR PreQuar_ =
CALCULATE ( SUM ( 'Table'[Value] ), DATEADD ( 'Table'[Date], -1, QUARTER ) )
VAR ThisQuar_ =
SUM ( 'Table'[Value] )
RETURN
ThisQuar_ - PreQuar_
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @RilwanFlame
You can utilize the Row Totals to display the change between the last two quarters. Assuming the original measure is SUM ( Table[Sales] ) and that you have a year-quarter column in your date table in the format YYYYQ
then [Sales Amount] can be modified to something like
Sales Amount =
VAR CurrentYearQuarter =
MAX ( 'Date'[Year Quarter] )
VAR CurrentSales =
SUM ( Table[Sales] )
VAR LastSales =
CALCULATE (
SUM ( Table[Sales] ),
REMOVEFILTERS ( 'Date' ),
'Date'[Year Quarter] = CurrentYearQuarter
)
VAR PerviousSales =
CALCULATE (
SUM ( Table[Sales] ),
REMOVEFILTERS ( 'Date' ),
'Date'[Year Quarter] = CurrentYearQuarter - 1
)
RETURN
IF (
HASONEVALUE ( 'Date'[Year Quarter] ),
CurrentSales,
PerviousSales - LastSales
)
YearQuarter column should be of integer data type. I sent you a code for a datetable in a private message. Please apply the code to create a new date table. The only thing you need to do is to replace Sales[Order Date] with name of the date column in your sales table. Then you can use the [Year Quarter Number] column in the measure's code
Hi Tamerj-
Thank you for your response. I do not have a date table (calendar table) created. I am using the Date field coming directly from my dataset and it does not have year-quarter.
What if i want to create a calendar(date) table with a year-quarter in it and then with a relationship to my actual dataset table.
Thank you
Thank you
Yes you haveto have a DateTable with at least date, year, quarter and year-quarter. Then build one to many relationship with the sales fact table. In your table visual use the date attributes from the DateTable. Then it should work.
creating such table shall not be an issue. If your having trouble creating it please let me know
Yes please, i will need help creating that.
So far, i have the below created
Hi Tamerj-
Im stil working on getting the difference between the current quarter and previous quarter.
After creating the Date table, some DAx measure created got messed up. Like the Quarter To Dtae Change (QTD Chg) and Year To Date Change (YTD Chg). it start populating 0.00%
Before creating the Date table, this use to be my formula for QTD Chg:
And for YTD Chg:
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
21 | |
14 | |
11 | |
8 | |
5 |
User | Count |
---|---|
26 | |
21 | |
20 | |
14 | |
10 |