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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

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

It works with me...

Capture.PNG

 

 

Cheers, Edgar Walther
ITsmart BI and Analytics consultant

View solution in original post

14 REPLIES 14
waltheed
Solution Supplier
Solution Supplier

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

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

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

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.

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.

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

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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