Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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
Solved! Go to 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
@azaterol check out this pattern and adjust it to your model:
https://www.daxpatterns.com/hierarchies/
@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
Add again your sales measure the sales field and click fiel on visualisation pane
and show as percentage of taotal and it should work
User | Count |
---|---|
124 | |
108 | |
99 | |
62 | |
62 |
User | Count |
---|---|
137 | |
115 | |
102 | |
71 | |
61 |