cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
azaterol
Regular Visitor

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

 

 

 

3 REPLIES 3
SpartaBI
Resident Rockstar
Resident Rockstar

@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

SpartaBI
Resident Rockstar
Resident Rockstar

@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

JamesFr06
Resolver I
Resolver I

 

 

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
Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

charticulator_carousel_with_text (1).png

Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!

Power BI Dev Camp Session 22 768x460.jpg

Check it out!

Mark your calendars and join us on Thursday, May 26 at 11a PDT for a great session with Ted Pattison!