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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Supritha1594
Regular Visitor

Multiply Average with months count

Hi,

 

I have a requirement where I have to show the target line graph in ascending order. I have to take an average of the selected months revenue and multiply that with the selected months count. If I select June, July, and Agust, then It should consider the count of june as 1, july as 2 and August as 3. My average is a Pure measure. I don't need a column for target. I want to just create a measure for this caculation and use it in the line graph.

Below is the sample of what I am looking for.

Supritha1594_0-1706191299199.png

 


Thanks in advance:)

 

3 REPLIES 3
DallasBaba
Skilled Sharer
Skilled Sharer

@Supritha1594, you can modify the SWITCH function to make it more flexible. Here's a revised approach using the following DAX formula:

Target = 
VAR SelectedMonths = VALUES('Table'[Month])
RETURN
    AVERAGE([Revenue]) * 
    SUMX(
        FILTER(ALL('Table'[Month]), 'Table'[Month] IN SelectedMonths),
        RANK.EQ('Table'[Month], 'Table'[Month], 0)
    )

This way, the formula dynamically adjusts to any range of selected months. You can use this measure in his line graph to achieve the desired results.

 

Let me know if this works for you. @ me in replies, or I'll lose your thread!!!  
Note:
If this post is helpful, please mark it as the solution to help others find it easily. Also, if my answers contribute to a solution, show your appreciation by giving it a thumbs up
Thanks
Dallas
DallasBaba
Skilled Sharer
Skilled Sharer

@Supritha1594 you can navigate to the “Fields” pane. Locate the table housing the revenue data you wish to utilize. Proceed to the “Modeling” tab and select the “New Measure” button.

In the formula bar, input the following formula:

Target = AVERAGE([Revenue]) * SWITCH(SELECTEDVALUE('Table'[Month]), "June", 1, "July", 2, "August", 3, 0)

Ensure to rename “Table” with the accurate name of the table containing the month data, “Revenue” with the appropriate column name for revenue data, and “Month” with the column name for month data. Once done, save the measure and integrate it into your line graph.

 

This measure will calculate the average revenue for the selected months and multiply it by the number of months chosen. The SWITCH function will return 1 for June, 2 for July, 3 for August, and 0 for any other month. This will ensure that the count is correct for the selected months.

 

 Let me know if this works for you. @ me in replies, or I'll lose your thread!!!  
Note: 
If this post is helpful, please mark it as the solution to help others find it easily. Also, if my answers contribute to a solution, show your appreciation by giving it a thumbs up
Thanks
Dallas

@DallasBaba  thank you for your response! 
But everytime it won't be june, july, and august. User may select any range of months. For example if an user selects January and february then it should be 1 for january and 2 for february. Is it possible in that way?

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors