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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
azaterol
Helper V
Helper V

Sales in percentage

Hello all,

I have a matrix of each main product group. If you click on the main product group, the matrix will open and the items will pop up. 
Already there is the quantity and the sales. 

 

Now I want create a measure which calculate the sales in percentage of the total sales. 

 

pbi_new.PNG

 

 

Have you any ideas?

Thank you all for your answers

--

azaterol

 

 

 

1 ACCEPTED SOLUTION

@azaterol I adjusted the code to your model:

 

% Parent 2 = 
VAR Numerator = SUM('Table'[Sales])
VAR Denominator =
    SWITCH (
        TRUE(),
        ISINSCOPE ( 'Table'[Items + number] ), CALCULATE ( SUM('Table'[Sales]), ALLSELECTED('Table'), VALUES('Table'[Main product group]) ),
        ISINSCOPE ( 'Table'[Main product group] ), CALCULATE ( SUM('Table'[Sales]), ALLSELECTED('Table')),
        Numerator
    )
VAR Result =
    DIVIDE (
        Numerator,
        Denominator
    )
RETURN
    Result

 

 


2022-05-09 22_36_04-Power BI Workspace Datasets License Permissions - Microsoft Power BI Community.png

Showcase Report – Contoso By SpartaBI


SpartaBI_3-1652115470761.png  SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Full-Logo11.png

View solution in original post

3 REPLIES 3
SpartaBI
Community Champion
Community Champion

@azaterol check out this pattern and adjust it to your model:
https://www.daxpatterns.com/hierarchies/


2022-05-09 22_36_04-Power BI Workspace Datasets License Permissions - Microsoft Power BI Community.png

Showcase Report – Contoso By SpartaBI


SpartaBI_3-1652115470761.png  SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Full-Logo11.png

@azaterol I adjusted the code to your model:

 

% Parent 2 = 
VAR Numerator = SUM('Table'[Sales])
VAR Denominator =
    SWITCH (
        TRUE(),
        ISINSCOPE ( 'Table'[Items + number] ), CALCULATE ( SUM('Table'[Sales]), ALLSELECTED('Table'), VALUES('Table'[Main product group]) ),
        ISINSCOPE ( 'Table'[Main product group] ), CALCULATE ( SUM('Table'[Sales]), ALLSELECTED('Table')),
        Numerator
    )
VAR Result =
    DIVIDE (
        Numerator,
        Denominator
    )
RETURN
    Result

 

 


2022-05-09 22_36_04-Power BI Workspace Datasets License Permissions - Microsoft Power BI Community.png

Showcase Report – Contoso By SpartaBI


SpartaBI_3-1652115470761.png  SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Full-Logo11.png

Anonymous
Not applicable

 

 

Add again your sales measure the sales field and click fiel on visualisation pane

JamesFr06_0-1652517869557.png

and show as percentage of taotal and it should work

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

May 2025 Monthly Update

Fabric Community Update - May 2025

Find out what's new and trending in the Fabric community.