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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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.

Have you any ideas?

Thank you all for your answers

--

azaterol

1 ACCEPTED SOLUTION
Community Champion

@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``````

Showcase Report – Contoso By SpartaBI

3 REPLIES 3
Community Champion

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

Showcase Report – Contoso By SpartaBI

Community Champion

@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``````

Showcase Report – Contoso By SpartaBI

Anonymous
Not applicable

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

and show as percentage of taotal and it should work

## Helpful resources

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Join our Community Sticker Challenge

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

#### Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

#### Fabric Community Update - July 2024

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

Top Solution Authors
Top Kudoed Authors