Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello everyone,
I want to create a P&L waterfall, from gross sales to gross margin. For this, I have a table which comprises ,a column for gross sales, a column for net sales, margin, a column for the year, column for product type and so on. To create the visualisation I need, I am using an intermediate table, with the first column called "attributes" including gross sales, trade terms, promotions, net sales,COGS margin etc. Then, I will need to create 3 measures: value for the base (only value for gross sales, net sales and margin), a measure for calculating negative value (so only calculating the sum of trade terms, promotions and COGS), a measure which will be showed as transparent (little trick to set up a waterfall with a bar chart).
I was wondering how to create those 3 caculations based on the columns in my first table. For my first measure and if I were to use excel, it will be: if(attribute="gross sales", sum(gross sales), if(attribute="net sales", sum(net sales), if(attribute="gross margin", sum(gross margin),0). I want these measures to be linked to my first table in order to use slicers and the value will update.
However, I don't know how to create these 3 measures based on my attributes displayed as rows.
Would you have an idea on how I can do it?
Thanks in advance for your help
Solved! Go to Solution.
Hi @Hugo62Glu ,
You can use Switch() function to achiveve this goal.
Here is a simple example:
I created three simple measures, each of them is just the name of themselves.
Then create a new measure :
Measure =
SWITCH(SELECTEDVALUE('intermediate table'[attributes]),
"gross margin",[gross margin],
"gross sales",[gross sales],
"net sales",[net sales],0)
Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Hugo62Glu ,
You can use Switch() function to achiveve this goal.
Here is a simple example:
I created three simple measures, each of them is just the name of themselves.
Then create a new measure :
Measure =
SWITCH(SELECTEDVALUE('intermediate table'[attributes]),
"gross margin",[gross margin],
"gross sales",[gross sales],
"net sales",[net sales],0)
Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Hugo62Glu 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.