I am trying to write a measure which will yield the incremental totals for a visualisation.
Imagine this table:
Both tables are sorted by the % Pen high to low
Now I would like to be able to add another column which tells me the incremental contribution of each product.
Here is an example:
|Product||% Pen||Incremental % Pen|
The 'Incremental % Pen' column needs to filter away overlapping data between the earlier product and itself as to only present the actual contribution added by the product.
My data model has the following (relevant) tables:
I've tried searching for ways to do cumulative/incremental calculations, but what I find seems to be on a table level whereas I need it to be dynamic ie. calculated according to the products selected in the visualisation. I imagine I need a RANKX element to rank based on my [% Pen] measure along with some clever filters but I am in deep here to be quite honest.
I am having a difficult time figuring out how to crack this so please do ask for more info if something is needed. Any help would be much appreciated.
Here is my best attempt so far:
VAR _Rank = RANKX( ALLSELECTED( 'Product'[EAN] ) , CALCULATE( [Penetration] ) ) RETURN CALCULATE( [Penetration], TOPN( _Rank, ALLSELECTED( 'Product'[EAN] ), [Penetration] ) )
Unfortuneately, I get the same value on every row of my visualisation using this measure:
@Anonymous In your example, where did the 1.4% come from for Prod2 for Incremental? Same question for the .2 for Prod3
I'm kind of a rookie and realize that I obviously need to filter away users from my calculation in order to get the 'added contribution' for each product/row evaluated.
I have tried to incorporate this into my measure:
VAR _Rank = RANKX( ALLSELECTED( 'Product'[EAN] ) , CALCULATE( [Penetration] ) ) VAR _User = ALLSELECTED(User[UserId]) VAR _FilteredCalc = CALCULATE( [Penetration], FILTER( 'User', NOT ( 'User'[UserId] ) IN _User ) ) RETURN CALCULATE( [Penetration], TOPN( _Rank, ALLSELECTED( 'Product'[EAN] ), [Penetration] ) )
But I will admit there is a decent chance I am trying to solve this in a nonsensical way unfortuneately.
This returns a blank value which I suspect is because my use of ALLSELECTED to select user to filter away is wrong
Thank you for your reply @Greg_Deckler,
I essentially made it up. But it would be the remaining % Pen after filtering away purchases which overlaps each other (User buys both products). I hope this clears it up.
@Anonymous Would need more information, particularly about this overlap. Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
Find out who won the T-Shirt Design Challenge and the top 3 finalists.
Find out more about the March 2023 update.