Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi. I need to do the following. I have a table of, say, products sold. Each row shows the selling price. It also shows the profit (selling price minus cost.) The bottom of the table shows the total profit % (gross profit %). That's the total profit divided by the total revenue (selling price). The table also shows the the GP% for each individual row. What I now need is to add another column to show what the total GP% would be if i were to exclude the current row from the sales transactions. Is there a way to accomplish this and at any level of granularity?
item | Revenue | GP$ | GP% | Total GP% without current item |
item1 | 1,000 | 900 | 90.0% | 54% |
item2 | 2,000 | 1,200 | 60.0% | 60% |
item3 | 3,000 | 1,500 | 50.0% | 70% |
Total GP% | 60% |
Hi @Anonymous ,
Has your problem been solved?
Best regards,
Lionel Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @v-lionel-msft . Thanks so much. Your solution works. However, it works at one level only. I needed it to work for each level in the hierarchy as in the below table. Thanks so much for your efforts!
Hi, @v-lionel-msft . Sorry, I noted below that I am on vacation. I can't actually verify right now because I do not have the work laptop. I promise to verify and let you know by the end of the weekend. Thank you so much for your caring.
Thanks @v-lionel-msft. I'm away from work now. I will review and will get back to you by the end of the week.
You could try:
ExCurrentRow = let tbl = PriorStepName, ThisItem = each [ItemID],
Ex = Table.SelectRows(tbl, each [ItemID] <> ThisItem),
RevEx = List.Sum(Ex[Revenue]),
GPEx = List.Sum(Ex[GP$])
in
Table.AddColumn(PriorStepName, "GPExCurrentRow", each GPEx / RevEx)
--Nate
Thanks @watkinnc . Your solution seems to be using M Query. I need this to work at the visual level. Thanks so much for your response.
Thanks @Fowmy GP$ is going to be a simple measure: revenue - cost. Revenue is a column. It's a visual.
@Anonymous
Is this a Table Visual or a table in the model?
Are Revenue and GP$ are measures or columns?
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@Fowmy and @watkinnc . I kind of got something working there. I'm yet to test it for multiple granularity levels. However, as you can see from the screen grab, the total at the bottom of GP_Impact% is wrong. The way I got it to work so far is by doing the calculation for avery row twice--once using the all() function and another without it and then dividing the two.
Thanks @Fowmy GP$ is going to be a simple measure: revenue - cost. Revenue is a column. It's a visual. Also, I'm trying to make this solution work at any granularity. For instance, if, say, I have multiple aggregation levels, like, product segment that has many items. What will the result be if i were to drill up to the product segment? And, say, now there is even one more level, say, salesperson that has many segments, what will the result at that level? Thanks!
User | Count |
---|---|
139 | |
113 | |
103 | |
73 | |
63 |
User | Count |
---|---|
135 | |
126 | |
110 | |
70 | |
61 |