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
Pyrofenix
Regular Visitor

Show a card with % of total

I am trying to show the % of total sales that are made Product Revenue but keep getting an error or incorrect value when I try it.

 

2020 SalesSales Code
$45Advertising
$300Product Revenue
$5Service Fees
$65Advertising
$35Other

 

Product Revenue % ($300) / Total Revenue ($450) = 66.7%

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

Hi @Pyrofenix 

Create a measure

Measure = CALCULATE(SUM(Sheet8[2020 Sales]),FILTER(Sheet8,Sheet8[Sales Code]="Product Revenue"))/CALCULATE(SUM(Sheet8[2020 Sales]),ALLSELECTED(Sheet8))

Capture15.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
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-juanli-msft
Community Support
Community Support

Hi @Pyrofenix 

Create a measure

Measure = CALCULATE(SUM(Sheet8[2020 Sales]),FILTER(Sheet8,Sheet8[Sales Code]="Product Revenue"))/CALCULATE(SUM(Sheet8[2020 Sales]),ALLSELECTED(Sheet8))

Capture15.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

edhans
Super User
Super User

You want somethings along the lines of this. The ALL() in the denominator tells it to ignore all filters and get the entire total.

 

% of Total =
VAR CurrentSales =
    SUM( Table[Sales] )
VAR TotalSales =
    SUMX(
        ALL( Table ),
        Table[Sales]
    )
VAR Result =
    DIVIDE(
        CurrentSales,
        TotalSales,
        0
    )
RETURN
    Result

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

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.