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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Mauram68
New Member

Pivot table only showing variance between regions

Hello,

 

I have been stuck for some time now figuring this out. I have a table with regions and number of tickets. Now I want to create a pivot table which shows the regions in the rows and also in the columns. The value field should be populated with the difference of the number of tickets between the regions.  An example is shown in the table below.

Is this possible in Power BI? 

 

 NorthSouthWestEast
North0-123
South10......
West-2...0...
East-3......0

 

This is an example of the actual fact table:

Region#Tickets
North5
South6
West3
East2
1 ACCEPTED SOLUTION

Thanks. This was exactly what I was looking for.

View solution in original post

2 REPLIES 2
123abc
Community Champion
Community Champion

Yes, it is possible to achieve this in Power BI using DAX calculations and a matrix visual. You can create a calculated table or a DAX measure to calculate the variance between regions based on your ticket data.

Here's a general outline of the steps you can take:

  1. Import your data: Import your fact table into Power BI containing the regions and the number of tickets.

  2. Create a Calculated Table (optional): You can create a calculated table that represents the cross join of your regions. This will ensure that all combinations of regions are included in your analysis.

  3. Create DAX Measure for Variance: Create a DAX measure that calculates the variance between regions based on the number of tickets. You can use DAX functions like SUMX and RELATED to calculate the variance.

  4. Design your Matrix Visual: Place your regions in both rows and columns of a matrix visual. Then, place your DAX measure for variance in the values section of the matrix visual.

Here's an example of how you might write the DAX measure for the variance:

 

Variance =
VAR Region1 = SELECTEDVALUE('Regions'[Region1])
VAR Region2 = SELECTEDVALUE('Regions'[Region2])

RETURN
IF(
Region1 = Region2,
BLANK(), -- or 0 if you prefer
CALCULATE(
SUM('FactTable'[#Tickets]),
FILTER(
'FactTable',
'FactTable'[Region] = Region1
)
) - CALCULATE(
SUM('FactTable'[#Tickets]),
FILTER(
'FactTable',
'FactTable'[Region] = Region2
)
)
)

 

Ensure that your 'FactTable' and 'Regions' table names match your actual table names.

This measure calculates the difference in the number of tickets between two selected regions. If the regions are the same, it returns BLANK(). You can adjust this measure according to your specific requirements and the structure of your data model.

Once you have this set up, your matrix visual should display the variance between regions as per your requirements.

 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

 

Thanks. This was exactly what I was looking for.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.