Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
SushainKoul
Helper III
Helper III

Query regarding time intelligence function

SushainKoul_0-1619085703402.png

 

No.

Measure

Thoughts

1

% of previous quarter

For each quarter, what percentage the total quantity sold constitutes of the same figure for the previous quarter.

2

YTD % of all previous year

For each time period, the cumulative year-to-date figure divided by total quantity sold for the whole of the previous year.

3

3-month moving average

The average of the total quantity sold for the previous 3 months.

 

In the first figure, this is the table I need to work on in Power BI. I am already given this table.

In the above table, I need to create three measures whose names are given as mentioned. I did the second measure perfectly but I am facing problem in creating first and third measure. Anyone plz help with this and kindly tell me what DAX formula I should use so that I can create these measures. Your help will be highly appreciated.

 

Thank u in advance.

3 REPLIES 3
amitchandak
Super User
Super User

@SushainKoul , with help from the date table and time intelligence

 

QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(('Date'[Date])))
Last QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],-1,QUARTER)))

 

Last Year same QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],-4,QUARTER)))

 

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))

 

Rolling 3 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date]),-3,MONTH))
Rolling 3 before 3 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAXX('Date',dateadd('Date'[Date],-3,month)),-3,MONTH))

 

You can take diff

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Sir, In all the expressions where u have mentioned DATESADD function its showing some sort of error as I had also tried using DATESADD but didn't get the desired result. 

SushainKoul_0-1619088702116.png

Here is the output sir.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.