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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
NewbieJono
Post Patron
Post Patron

Applying a Weighting to a set of percentages

Hello, i need to apply a weighting to a percentage result for four transactions. i can then add up the four weighted results to give and over score.

 

i have Dax to show the percentage YTD, this works fine. i also have a sample rate table to show what weighting to apply.

 

i can do this in excel but not sure about DAX.

 

Excel formula is Percentage YTD * Sample Rate / 100

 

Capture.PNG

 

I have a table that shows what sample rate to apply depending on date. The results are monthly figures. i am not sure how i tell power bi to lookup the appropriate sample rate

 

Capture.PNG

 

 

 

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

Hi @Wilson_ ,thanks for the quick reply.

Hi @NewbieJono ,

The Table data is shown below:

vzhouwenmsft_0-1711704076734.png

vzhouwenmsft_1-1711704108774.png

Please follow these steps:

1.Use the following DAX expression to create a table named 'Table3'

Table3 = FILTER('Table2','Table2'[Date From] = DATE(2023,7,1))

2.Use the following DAX expression to create a column named 'Sample Rate' in 'Table'

Sample Rate = LOOKUPVALUE(Table3[Sample Rate],'Table3'[Transaction],'Table'[Transaction Service])

3.Use the following DAX expression to create a column named 'Result' in 'Table'

Result = [Percentage YTD] * [Sample Rate] / 100

4.Use the following DAX expression to create a measure

Measure = IF(SELECTEDVALUE('Table'[Percentage YTD]),SELECTEDVALUE('Table'[Result]),SUM('Table'[Result]))

5.Final output

vzhouwenmsft_2-1711704458375.png

vzhouwenmsft_3-1711704490546.png

 

Best Regards,
Wenbin Zhou
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

2 REPLIES 2
v-zhouwen-msft
Community Support
Community Support

Hi @Wilson_ ,thanks for the quick reply.

Hi @NewbieJono ,

The Table data is shown below:

vzhouwenmsft_0-1711704076734.png

vzhouwenmsft_1-1711704108774.png

Please follow these steps:

1.Use the following DAX expression to create a table named 'Table3'

Table3 = FILTER('Table2','Table2'[Date From] = DATE(2023,7,1))

2.Use the following DAX expression to create a column named 'Sample Rate' in 'Table'

Sample Rate = LOOKUPVALUE(Table3[Sample Rate],'Table3'[Transaction],'Table'[Transaction Service])

3.Use the following DAX expression to create a column named 'Result' in 'Table'

Result = [Percentage YTD] * [Sample Rate] / 100

4.Use the following DAX expression to create a measure

Measure = IF(SELECTEDVALUE('Table'[Percentage YTD]),SELECTEDVALUE('Table'[Result]),SUM('Table'[Result]))

5.Final output

vzhouwenmsft_2-1711704458375.png

vzhouwenmsft_3-1711704490546.png

 

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

Wilson_
Memorable Member
Memorable Member

Hi NewbieJono,

 

Can you share a little more? For example, what does your data model look like? When you say depending on date, what date does it depend on? etc.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.