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
Balhemkan
Helper III
Helper III

Month average

Hi Team, 

 

I have one transaction table on that i have values from Jan -2022 to Jan - 2023

But Oct data is missing in that. Month itself not available in transaction data.

 

I have Date table and Transaction table

In date table i have Date Column

In Transaction table i have two Columns Date column and Sales Amount

I give join from Date table Date column to Transaction Table Date Column

My requirement is if i select only one month in Date table Date column I need to get sum of Sales amount for that particular month. If i select more than one month in Date column i need to get Average for selected months.

 

I written below formula

 

Countmonths =  MONTH(COUNT(Date_table[date]))

 

Sales =

IF([countmonths]<=1,SUM(Facttable[Sales]),IF([countmonths]>1,SUM(Facttable'[Sales])/[countmonths]))

 

This is working if i select Jan-22 to Sep -22 but if i select Oct to dec its not working properly because oct-22 is not available

 

Thanks, 

Balhemkan

1 REPLY 1
MohammadLoran25
Solution Sage
Solution Sage

Hi @Balhemkan 

To get your problem solved:

 

At first make a measure:

SalesAmount=SUM(Facttable'[Sales])

 

Then make another measure for your Average as below which refers to previous measure:

 

AVERAGESalesAmount=

AVERAGEX(VALUES(Date_Table[YearMonth]),[SalesAmount])
 
If this answer solves your problem, please mark it as an accepted solution so the others would find what they need easier.
Regards,
Loran

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.