Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Ratio to parent market share is a very common measure to use in any Business. I have search many times but didnt get exact solution and dax query.
Will it be possible to add this in up coming update in power BI as quick measure?
Thanks
Aamir
Solved! Go to Solution.
Hi @mdaamirkhan,
This is something about context. I worked it out, but it can't be used generally.
test2 = IF ( ISFILTERED ( PFIZER_RADER_REPORTING[International Product] ), SUM ( PFIZER_RADER_REPORTING[Sales Mnf] ) / CALCULATE ( SUM ( PFIZER_RADER_REPORTING[Sales Mnf] ), ALL ( PFIZER_RADER_REPORTING[International Product] ) ), IF ( ISFILTERED ( PFIZER_RADER_REPORTING[Sub Market 1] ), SUM ( PFIZER_RADER_REPORTING[Sales Mnf] ) / CALCULATE ( SUM ( PFIZER_RADER_REPORTING[Sales Mnf] ), ALLEXCEPT ( PFIZER_RADER_REPORTING, PFIZER_RADER_REPORTING[Sub Market 1] ) ), IF ( ISFILTERED ( PFIZER_RADER_REPORTING[Market] ), SUM ( PFIZER_RADER_REPORTING[Sales Mnf] ) / CALCULATE ( SUM ( PFIZER_RADER_REPORTING[Sales Mnf] ), ALLEXCEPT ( PFIZER_RADER_REPORTING, PFIZER_RADER_REPORTING[Market] ) ), 1 ) ) )
Take the first two field as example. The context of "PIPERAC/TAZO FRES" is "International Product", while the context of "Total" is "Sub Market 1". So the formula chooses the wrong "if" clause.
Best Regards!
Dale
Hi, try this one please: Ratio_Demo
Best Regards!
Dale
Hi Aamir,
Could you please share a sample here? Maybe we could work it out.
Maybe you could submit an idea in power-bi-ideas.
Maybe you could try a formula like this:
ratio = SUMX ( sales, sales[quantity] * sales[unit price] ) / CALCULATE ( SUMX ( sales, sales[quantity] * sales[unit price] ), ALL ( sales ) )
Best Regards!
Dale
I use this dax query for Ratio To Market share but its showing wrong value
Ratio To Market share =
IF (
ISFILTERED (PFIZER_RADER_REPORTING[International Product]),
SUM (PFIZER_RADER_REPORTING[Sales Mnf])
/
CALCULATE (
SUM (PFIZER_RADER_REPORTING[Sales Mnf]),
ALL (PFIZER_RADER_REPORTING[International Product])
),
IF (
ISFILTERED (PFIZER_RADER_REPORTING[Sub Market 1]),
SUM (PFIZER_RADER_REPORTING[Sales Mnf])
/
CALCULATE (
SUM (PFIZER_RADER_REPORTING[Sales Mnf]),
ALL (PFIZER_RADER_REPORTING[Sub Market 1])
),
IF (
ISFILTERED (PFIZER_RADER_REPORTING[Market]),
SUM (PFIZER_RADER_REPORTING[Sales Mnf])
/
CALCULATE (
SUM (PFIZER_RADER_REPORTING[Sales Mnf]),
ALL (PFIZER_RADER_REPORTING[Market])
)
)
)
)
Hi @mdaamirkhan,
Your formula looks great. Maybe something is wrong with the report. Here is an example. Please check it out.
1. There are three fields in your field, so take care of these three fields when applying a filter;
2. It's better one filter a time.
Please refer to this post, maybe it would help. dax-universal-formula-to-calculate-difference-to-previous-period
9Measure = IF ( ISFILTERED ( 'Product'[Color] ), 1, 0 )
Best Regards!
Dale
didnt work
Any update on the Ratio To parent Hierarchy level? I wrote this query below but its show wrong value.
Hi @mdaamirkhan,
The picture you posted was corrupted. I can't see anything.
Could you please post the snapshot of the report? Based on the information here, I think the formula should work.
Best Regards!
Dale
In the screenshot you can see Total showing 49% which is wrong it should be 100%
MKTShareByMKTH =
IF (
ISFILTERED (PFIZER_RADER_REPORTING[International Product]),
SUM (PFIZER_RADER_REPORTING[Sales Mnf])
/
CALCULATE (
SUM (PFIZER_RADER_REPORTING[Sales Mnf]),
ALL (PFIZER_RADER_REPORTING[International Product])
),
IF (
ISFILTERED (PFIZER_RADER_REPORTING[Sub Market 1]),
SUM (PFIZER_RADER_REPORTING[Sales Mnf])
/
CALCULATE (
SUM (PFIZER_RADER_REPORTING[Sales Mnf]),
ALL (PFIZER_RADER_REPORTING[Sub Market 1])
),
IF (
ISFILTERED (PFIZER_RADER_REPORTING[Market]),
SUM (PFIZER_RADER_REPORTING[Sales Mnf])
/
CALCULATE (
SUM (PFIZER_RADER_REPORTING[Sales Mnf]),
ALL (PFIZER_RADER_REPORTING[Market])
)
)
)
)
Hi @mdaamirkhan,
It's a trick of context. The "Total" hasn't have a filter all the time. Try this formula please. (format to percentage)
MKTShareByMKTH = IF ( ISFILTERED ( PFIZER_RADER_REPORTING[International Product] ), SUM ( PFIZER_RADER_REPORTING[Sales Mnf] ) / CALCULATE ( SUM ( PFIZER_RADER_REPORTING[Sales Mnf] ), ALL ( PFIZER_RADER_REPORTING[International Product] ) ), IF ( ISFILTERED ( PFIZER_RADER_REPORTING[Sub Market 1] ), SUM ( PFIZER_RADER_REPORTING[Sales Mnf] ) / CALCULATE ( SUM ( PFIZER_RADER_REPORTING[Sales Mnf] ), ALL ( PFIZER_RADER_REPORTING[Sub Market 1] ) ), IF ( ISFILTERED ( PFIZER_RADER_REPORTING[Market] ), SUM ( PFIZER_RADER_REPORTING[Sales Mnf] ) / CALCULATE ( SUM ( PFIZER_RADER_REPORTING[Sales Mnf] ), ALL ( PFIZER_RADER_REPORTING[Market] ) ), 1 ) ) )
Best Regards!
Dale
Same query I have tried before which is showing wrong value in Total as well as productwise value total.
Hi @mdaamirkhan,
Are there any other filters or slicers?
Best Regards!
Dale
Attributeslicers on the left side in the screenshot but didnt select anything in the fliter or slicer see value showing wrong it should be 100% . I have also prepared the sample data for you link: https://drive.google.com/open?id=0BxreilNC4AvsbzhBR2hvZG5tZVE
Hi @mdaamirkhan,
This is something about context. I worked it out, but it can't be used generally.
test2 = IF ( ISFILTERED ( PFIZER_RADER_REPORTING[International Product] ), SUM ( PFIZER_RADER_REPORTING[Sales Mnf] ) / CALCULATE ( SUM ( PFIZER_RADER_REPORTING[Sales Mnf] ), ALL ( PFIZER_RADER_REPORTING[International Product] ) ), IF ( ISFILTERED ( PFIZER_RADER_REPORTING[Sub Market 1] ), SUM ( PFIZER_RADER_REPORTING[Sales Mnf] ) / CALCULATE ( SUM ( PFIZER_RADER_REPORTING[Sales Mnf] ), ALLEXCEPT ( PFIZER_RADER_REPORTING, PFIZER_RADER_REPORTING[Sub Market 1] ) ), IF ( ISFILTERED ( PFIZER_RADER_REPORTING[Market] ), SUM ( PFIZER_RADER_REPORTING[Sales Mnf] ) / CALCULATE ( SUM ( PFIZER_RADER_REPORTING[Sales Mnf] ), ALLEXCEPT ( PFIZER_RADER_REPORTING, PFIZER_RADER_REPORTING[Market] ) ), 1 ) ) )
Take the first two field as example. The context of "PIPERAC/TAZO FRES" is "International Product", while the context of "Total" is "Sub Market 1". So the formula chooses the wrong "if" clause.
Best Regards!
Dale
It is possible to send me the solution file that you done this. it will be helpfu for me
Sure, please check this: https://1drv.ms/u/s!ArTqPk2pu-BkcREb4pQ_JKiq5PY
Best Regards!
Dale
Its not downloading can you share with google drive
Hi, try this one please: Ratio_Demo
Best Regards!
Dale
Thanks alot
Any update ?
User | Count |
---|---|
84 | |
79 | |
71 | |
48 | |
43 |
User | Count |
---|---|
111 | |
54 | |
50 | |
40 | |
40 |