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
Yuiitsu
Helper V
Helper V

Average based on the number of months that have revenue

Hi All

 

I need help on this result that I wish to get

Example: 

I want to get the average revenue of customer X based on the last 6 months. (Or any amount of months I choose in the slicer)

So in the slicer I choose the last 6 months (May till Oct) , however customer X does not have revenue every month.

Based on the screenshot below, X only have revenue on June and July. So I need the formula to work this way:

362,640 / 2 = 181,320

Yuiitsu_0-1700635196589.png

 

Similarly if i choose another customer Y now that only have sales for 4 months.

The formuala should be:

680,254 / 4 = 170,064

Yuiitsu_1-1700635367897.png

Tried using the average function but the result is not accurate.

Yuiitsu_2-1700635466799.png

Yuiitsu_4-1700635493617.png

 

Any idea how to write this DAX?

(I tried to 1st create a measure to count month if revenue is not blank but i think it is not working. The result is always the number of month i choose in the slicer and not how many months have revenue)

MonthCount = 
    CALCULATE(
        DISTINCTCOUNT('Date'[Month Name]),
            NOT(
                ISBLANK('Master Sales'[Revenue]
                
            )
        ))

 

1 ACCEPTED SOLUTION
v-cgao-msft
Community Support
Community Support

Hi @Yuiitsu ,

I noticed in the posted image that [Revenue] is not aggregated, at this point it passes a screener up filter to [Average of Revenue ], please try changing [Revenue] to [Sum of Revenue], at this point [Average] should work.

vcgaomsft_1-1700791022936.png
Please check the pbix file.

vcgaomsft_0-1700790988848.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

View solution in original post

1 REPLY 1
v-cgao-msft
Community Support
Community Support

Hi @Yuiitsu ,

I noticed in the posted image that [Revenue] is not aggregated, at this point it passes a screener up filter to [Average of Revenue ], please try changing [Revenue] to [Sum of Revenue], at this point [Average] should work.

vcgaomsft_1-1700791022936.png
Please check the pbix file.

vcgaomsft_0-1700790988848.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

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!

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.