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
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
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.