Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
I have a matrix broken shown as such:
I would like to create a difference column that would look like this in excel pivot table:
This is how the raw data looks like:
Let me know if any part is not clear. Happy to explain further.
Solved! Go to Solution.
@Anonymous
i got it
duplicate data source Table1 as 'Table 1 (2)'
then create new table
New Table = union('Table1';summarize('Table1 (2)';'Table1 (2)'[Vessel];'Table1 (2)'[Voyage];"Data Type";"zDifference";"Revenue";sumx('Table1 (2)';(calculate(SUM('Table1 (2)'[Revenue]);'Table1 (2)'[Data Type]="Actual")-calculate(SUM('Table1 (2)'[Revenue]);'Table1 (2)'[Data Type]="Estimate")));"Cost";sumx('Table1 (2)';(calculate(SUM('Table1 (2)'[Cost]);'Table1 (2)'[Data Type]="Actual")-calculate(SUM('Table1 (2)'[Cost]);'Table1 (2)'[Data Type]="Estimate")))))
aaand
all fields are from New Table, of course
do not hesitate to give a kudo to useful posts and mark solutions as solution
@Anonymous please use below measures
_cost =
VAR _actual = CALCULATE(SUM('Table'[Cost]),FILTER(ALLEXCEPT('Table','Table'[Vessel],'Table'[Voyage]),'Table'[data Type]="Actual"))
VAR _estimate = CALCULATE(SUM('Table'[Cost]),FILTER(ALLEXCEPT('Table','Table'[Vessel],'Table'[Voyage]),'Table'[data Type]="Estimate"))
RETURN _actual-_estimate_Revenue =
VAR _actual = CALCULATE(SUM('Table'[Revenue]),FILTER(ALLEXCEPT('Table','Table'[Vessel],'Table'[Voyage]),'Table'[data Type]="Actual"))
VAR _estimate = CALCULATE(SUM('Table'[Revenue]),FILTER(ALLEXCEPT('Table','Table'[Vessel],'Table'[Voyage]),'Table'[data Type]="Estimate"))
RETURN _actual-_estimate
Hi Vimal,
Thanks for your solution. But after inserting, it does not give me the intended result either. Please advise.
I am expecting get a result like this:
Hi @Anonymous
try 2 measures
RevenueMeasure = calculate(SUM(Table1[Revenue]);Table1[Data Type]="Actual")-calculate(SUM(Table1[Revenue]);Table1[Data Type]="Estimate")
CostMeasure = calculate(SUM(Table1[Cost]);Table1[Data Type]="Actual")-calculate(SUM(Table1[Cost]);Table1[Data Type]="Estimate")
do not hesitate to give a kudo to useful posts and mark solutions as solution
I tried that before, but putting it into the matrix table will result in the difference appearing within each subtype, which is not whtat I want.
@Anonymous
create 4 more measures
CostEstimate = calculate(SUM(Table1[Cost]);Table1[Data Type]="Estimate")
CostActual = calculate(SUM(Table1[Cost]);Table1[Data Type]="Actual")
RevenueActual = calculate(SUM(Table1[Revenue]);Table1[Data Type]="Actual")
RevenueEstimate = calculate(SUM(Table1[Revenue]);Table1[Data Type]="Estimate")
then
RevenueDifference = [RevenueActual]-[RevenueEstimate]
CostDifference = [CostActual]-[CostEstimate]
then visual
do not hesitate to give a kudo to useful posts and mark solutions as solution
Hi @az38 ,
I understand your solution, so you're suggesting leveling the hierarchy of datatype into the same level as the measures so as to create direct simple subtraction.
That can work but visually will not look as structured as I intended. Is there no other way to obtain the way I like in the excel output?
@Anonymous
i got it
duplicate data source Table1 as 'Table 1 (2)'
then create new table
New Table = union('Table1';summarize('Table1 (2)';'Table1 (2)'[Vessel];'Table1 (2)'[Voyage];"Data Type";"zDifference";"Revenue";sumx('Table1 (2)';(calculate(SUM('Table1 (2)'[Revenue]);'Table1 (2)'[Data Type]="Actual")-calculate(SUM('Table1 (2)'[Revenue]);'Table1 (2)'[Data Type]="Estimate")));"Cost";sumx('Table1 (2)';(calculate(SUM('Table1 (2)'[Cost]);'Table1 (2)'[Data Type]="Actual")-calculate(SUM('Table1 (2)'[Cost]);'Table1 (2)'[Data Type]="Estimate")))))
aaand
all fields are from New Table, of course
do not hesitate to give a kudo to useful posts and mark solutions as solution
Hi @az38 , @Anonymous
This is exactly I want to see in my solution . Can you please explain the 'New Table' concept in easier terms. I am quite new to PowerBI
Hi @az38
Yes I think this is what I am looking for and it should work for me!!
Thanks so much for your help!
@Anonymous
i think it is the easiest
but. you can dublicate your data source. make a group by vessel/voyage, calculate rev and cost difference, fill the field Data Type as "Difference" (or "zDifference" for correct cloumn ort), then union tables (initial and grouped), then add Data Type column in the matrix as columns.
wow. maybe you could understand, because im not sure that was good explanation of my idea 🙂
do not hesitate to give a kudo to useful posts and mark solutions as solution
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 53 | |
| 35 | |
| 31 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 75 | |
| 72 | |
| 39 | |
| 35 | |
| 23 |