Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
burak
Frequent Visitor

Difference between 2 columns in Matrix or Table

 

I have read some solutions about this issue, but all of them was about the difference between date. I could not run any formula about my issue.

 

My sample data is below:

UPLOAD.JPG

 

Is it possible to create a table or matrix in PBI looking like the following image? Currently, I am creating this table in Excel outside the pivot table, then import to the PBI. It takes so much time. If you help me, I will be more than happy.

upload2.JPG

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

Using an Enter Data query, I created a table with the following values:

  • S14
  • S15
  • S16

Relate this table to your other table. I then created the following measures:

 

SumUnitsTaken = SUMX(RELATEDTABLE(College),'College'[Unit Taken])

S15 vs S14 = CALCULATE([SumUnitsTaken],College[Term] = "S15") - CALCULATE([SumUnitsTaken],College[Term] = "S14")

S16 vs S15 = CALCULATE([SumUnitsTaken],College[Term] = "S16") - CALCULATE([SumUnitsTaken],College[Term] = "S15")

Create a table with College, S15 vs S14 and S16 vs S15



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

Using an Enter Data query, I created a table with the following values:

  • S14
  • S15
  • S16

Relate this table to your other table. I then created the following measures:

 

SumUnitsTaken = SUMX(RELATEDTABLE(College),'College'[Unit Taken])

S15 vs S14 = CALCULATE([SumUnitsTaken],College[Term] = "S15") - CALCULATE([SumUnitsTaken],College[Term] = "S14")

S16 vs S15 = CALCULATE([SumUnitsTaken],College[Term] = "S16") - CALCULATE([SumUnitsTaken],College[Term] = "S15")

Create a table with College, S15 vs S14 and S16 vs S15



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler For my own learning, can I ask the purpose of the Enter Data table you used? I got to the same end result of the desired matrix with just the three measures:

 

SumUnitsTaken = SUM(TableName[Unit Taken])

S15 vs S14 = CALCULATE([SumUnitsTaken], TableName[Term]="S15") - CALCULATE([SumUnitsTaken], TableName[Term]="S14")

S16 vs S15 = CALCULATE([SumUnitsTaken], TableName[Term]="S16") - CALCULATE([SumUnitsTaken], TableName[Term]="S15")

 

Table.PNG

Probably because I'm old school and still think in star schemas and snowflake schemas and fact and dimension tables. Old habits die hard.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Ha, nothing wrong with that! I just thought I might be missing out on something cool. Thanks!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.