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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
XuanHau
New Member

Monthly conditions for multi-month averages

Hello guys,
I have 4 tables for:
- Revenue and unit
- Purchase value
- Master data for price of product
- Yearmonth table
I want to create one detailed table on report with product, revenue, unit, purchase value and price of product

Generally the price = revenue / unit and there's an additional condition: if there is no revenue or units for a particular month, then the price should be null, and we will use the price from the master data instead for that month.

Unfortunately, I have a slicer that can select multiple months, so I need to calculate the average price after applying the above condition
For example:

pic1.png

Product B in the image: when choosing January, since we do not have both revenue and units, the price retrieved from the master data is 7. When selecting February, the price is calculated as 30/5 = 6. Therefore, when selecting January and February, the price of Product B would be 6.5.

So, Is there any way to apply a condition per month for the price first, and then calculate the average for multiple months?

Thank you in advance!

2 REPLIES 2
v-yilong-msft
Community Support
Community Support

Hi @XuanHau ,

I create three tables as you mentioned.

vyilongmsft_0-1715218433118.png

Then I create a measure and you will get what you need.

Average =
DIVIDE ( ( SUM ( Jan[Price] ) + SUM ( Feb[Price] ) ), 2 )

vyilongmsft_1-1715218510533.png

 

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yilong-msft 

The table for January, February, and the sum of January and February is a detailed table that I need to display on the report with data corresponding to the selected month/year slicer. It is not fixed fact table data, so I cannot use your suggestion

Thank you for your help!

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.