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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
siwyan_1
Regular Visitor

Average quarter data by month

Powerbi.PNG

I would like to average the quarterly Data by monty (right table, on MonthId 201510, sale data 2161650/3=720550), and add this number to left table accordingly.

Final look should be something like:

 

MonthId          TotalSales

201510            1287000(566450+720550)

201511            1523640(803090+720550)

201512            1597530(876980+720550)

 

Help please! 

 

 

3 ACCEPTED SOLUTIONS

waltheed
Impactful Individual
Impactful Individual

I think I got it.

 

This is the measure:

 

Avg by Q = 
	CALCULATE(
		SUM('Quarter'[USD Net Rev])/3,
		ALLEXCEPT('FiscalYMD', 'FiscalYMD'[Year Quarter]),
		VALUES(FiscalYMD[Year Quarter] )
	)

I also added two columns Year Month and Year Quarter to your date table:

 

Year Month = FiscalYMD[Year] & "-" & format(FiscalYMD[Month], "00")

Year Quarter = FiscalYMD[Year] & " Q" & FiscalYMD[Quarter]

Then it looks like this: 

 

Capture.PNG

Because I use VALUES of the quarters in the measure you can leave the quarters out of the table.

Here is the link to your file.

Cheers, Edgar Walther
ITsmart BI and Analytics consultant

View solution in original post

waltheed
Impactful Individual
Impactful Individual

It works with me...

Capture.PNG

 

 

Cheers, Edgar Walther
ITsmart BI and Analytics consultant

View solution in original post

14 REPLIES 14
waltheed
Impactful Individual
Impactful Individual

Do you have a date dimension table?

That would make it a bit easier. Then you can refer to quarters and months in your measures. 

Cheers, Edgar Walther
ITsmart BI and Analytics consultant
waltheed
Impactful Individual
Impactful Individual

This may be what you need:

 

Create a new Measure:

Avg by Q = calculate(sum(FactOnlineSales[SalesAmount])/3 , all('Date'[CalendarMonth]))

 

And then another measure to sum the new one and your existing monthly total:

Total = [Your Monthly Totals] + [Avg by Q]

 

Capture.PNG

 

Would that work?

 

Cheers, Edgar Walther
ITsmart BI and Analytics consultant

sssssssssssssss

waltheed
Impactful Individual
Impactful Individual

Hi siwyan_1,

Can you please mark my post as the solution?

(Using a ; or , depends on your regional settings in windows. )

Thanks, Edgar

Cheers, Edgar Walther
ITsmart BI and Analytics consultant

Hi Edgar,

 

This still does not solve my problem. 

This is what I put into the measure: Avg by Q = CALCULATE(sum('Retail_Quarter'[USD Net Rev])/3,ALL('CalendarMonthYear'[MonthBeginID]))

The averaged data (right table)  does not fill into all monthes on left table. e.g. right table Month 201507 average is 791,697; this number only showed up on left table for month 201507. The 201508 and 201509 do not have any number fill in. 

 

I've been hitting my head against the wall the whole morning and trying to get it solved. but still no solution. Help please. 

 

 

Power BI2.PNG

waltheed
Impactful Individual
Impactful Individual

The difference with my example is that I have a date dimension table, which links the months to quarters.

Do you have that as well? It's highly recommended. 

Cheers, Edgar Walther
ITsmart BI and Analytics consultant

Hi Edgar,

Yes, I have a date dimention table. And montly sale and quarter sale tables are refering to the date dimention table. But still the averaged quarterly data still only fill in one month of that quater instead of all monthes. 

Please advise.

waltheed
Impactful Individual
Impactful Individual

Can you share your pbix file?

Cheers, Edgar Walther
ITsmart BI and Analytics consultant

Hi,

 

I don't know how to upload a file here. This is the link to download the file: 

https://fere.me/yaup/jbiqwq/

thank you for your help.

waltheed
Impactful Individual
Impactful Individual

I think I got it.

 

This is the measure:

 

Avg by Q = 
	CALCULATE(
		SUM('Quarter'[USD Net Rev])/3,
		ALLEXCEPT('FiscalYMD', 'FiscalYMD'[Year Quarter]),
		VALUES(FiscalYMD[Year Quarter] )
	)

I also added two columns Year Month and Year Quarter to your date table:

 

Year Month = FiscalYMD[Year] & "-" & format(FiscalYMD[Month], "00")

Year Quarter = FiscalYMD[Year] & " Q" & FiscalYMD[Quarter]

Then it looks like this: 

 

Capture.PNG

Because I use VALUES of the quarters in the measure you can leave the quarters out of the table.

Here is the link to your file.

Cheers, Edgar Walther
ITsmart BI and Analytics consultant

PowerBI1.PNGPowerBI2.PNG

It works perfect without any additional dimentions. After adding in the 'platform' dimention, it cracked again.  

Any idea? Thank you so much for your help. 

Anonymous
Not applicable

Hello,

 

janibasha1217_0-1630342744868.png

 

i exactly need this but not able to get it.. can you help me out ? share me the sample pbix file if possible

waltheed
Impactful Individual
Impactful Individual

It works with me...

Capture.PNG

 

 

Cheers, Edgar Walther
ITsmart BI and Analytics consultant

Power BI2.PNG

 

Sorry, this actuall not solved my problem. 

this is what I tried:

Avg by Q = CALCULATE(sum('Retail_Quarter'[USD Net Rev])/3,ALL('CalendarMonthYear'[MonthBeginDate].[Date]))

 

I tried to change the ',' marked in red above to ';'  but it gives me error message saying ':' is not allowed.

 

Help Please!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.