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
Paulyeo11
Impactful Individual
Impactful Individual

How to make Contribution expression dynamic ?

Hi All

 

Below script is working fine , But the expression need to enter COMPANY field. it there a way to make it flexiable ? so that can be use for all field .

 

Contribution = 100 * DIVIDE(SUM('Table'[Sales]), CALCULATE(SUM('Table'[Sales]), ALL('Table'[COMPANY])))
 

Paulyeo11_0-1604560100245.png

 

1 ACCEPTED SOLUTION

@Paulyeo11 ,

Contribution = 100 * DIVIDE(SUM('Table'[Sales]), CALCULATE(SUM('Table'[Sales]), ALLSELECTED('Table'[COMPANY])))
Contribution = 100 * DIVIDE(SUM('Table'[Sales]), CALCULATE(SUM('Table'[Sales]), ALLSELECTED('Table')))

 

 

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Paulyeo11 , not very clear , but try allselected

Contribution = 100 * DIVIDE(SUM('Table'[Sales]), CALCULATE(SUM('Table'[Sales]), ALLSELECTED('Table')))

 

also no need *100 (100*) as you can mark it as % column

Hi Amit

I have try allselected , got syntax error

Paulyeo11_0-1604561215120.png

 

@Paulyeo11 ,

Contribution = 100 * DIVIDE(SUM('Table'[Sales]), CALCULATE(SUM('Table'[Sales]), ALLSELECTED('Table'[COMPANY])))
Contribution = 100 * DIVIDE(SUM('Table'[Sales]), CALCULATE(SUM('Table'[Sales]), ALLSELECTED('Table')))

 

 

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.