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
NadiaLR1234
Helper I
Helper I

Apply measures filters in one measure

Hi

I have the following averages - on their own they work fine

Avg = DIVIDE(SUM(vw_REN_PBI[TotalSales]),SUM(vw_REN_PBI[Trns]),0)
AvgC = DIVIDE(SUM(vw_REN_PBI[TotalSales]),SUM(vw_REN_PBI[ProdNoDays2]),0)
 
However I want to combine them into one measure/column so I can use one field on both condtions 
example I have tried: AvgRental = IF(ProdTypeDesc = "Car Rental", AvgC, IF(ProdTypeDesc = "Transfers",Avg,0)
but this is not calculating the averages correctly ?
 
Please assist with the correct formulation expression and if the new field should be a measure or a column ?
 
 

 

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

Hi @NadiaLR1234 ,

 

According to your description, I suggest that you can use calculated columns to return "Avg","AvgC" and "AvgRental".

Measure carries the formula which eventually gives the output, so when we use measure1 in another measure2, it will calculate according to the formula of measure1 instead of the result of measure1.

Create three calculated columns.

average = DIVIDE(SUM('Table'[total sales]),SUM('Table'[trns]),0)
averagec = DIVIDE(SUM('Table'[total sales]),SUM('Table'[prodnodays]),0)
Column = IF('Table'[type]="car rental",[average],IF('Table'[type]="trans",[averagec],0))

Final output:

vxiaosunmsft_0-1669686108482.png

 

Best Regards,
Community Support Team _ xiaosun

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

View solution in original post

1 REPLY 1
v-xiaosun-msft
Community Support
Community Support

Hi @NadiaLR1234 ,

 

According to your description, I suggest that you can use calculated columns to return "Avg","AvgC" and "AvgRental".

Measure carries the formula which eventually gives the output, so when we use measure1 in another measure2, it will calculate according to the formula of measure1 instead of the result of measure1.

Create three calculated columns.

average = DIVIDE(SUM('Table'[total sales]),SUM('Table'[trns]),0)
averagec = DIVIDE(SUM('Table'[total sales]),SUM('Table'[prodnodays]),0)
Column = IF('Table'[type]="car rental",[average],IF('Table'[type]="trans",[averagec],0))

Final output:

vxiaosunmsft_0-1669686108482.png

 

Best Regards,
Community Support Team _ xiaosun

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

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.