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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
DTHOMSON198409
New Member

How to Pivot using multiple columns

HI,

 

I am in the middle of creating a dashboard from the below Data 

 

DTHOMSON198409_0-1716550855604.png

 

I have been tasked with providing something along the lines of the below where for each DM_CODE FOR each day and price point they would see the difference in prices between each price source, so the user can determine which price is the best or if they are all the same ?

 

Any help would be appreciated 

DTHOMSON198409_1-1716551621311.png

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @DTHOMSON198409 ,

The Table data is shown below:

vzhouwenmsft_0-1716780080223.png

Please follow these steps:

1.Adding indexed columns after grouping with Power Query

vzhouwenmsft_1-1716780267193.png

vzhouwenmsft_2-1716780294695.png

vzhouwenmsft_4-1716780459496.png

2.Delete column 'Count', expand column 'Coustom'

vzhouwenmsft_5-1716780563547.png

vzhouwenmsft_6-1716780599950.png

vzhouwenmsft_8-1716780661072.png

3.Use the following DAX expression to create columns

 

bid_price = 
VAR _a = [DM_CODE]
VAR _b = [price_point]
RETURN CONCATENATEX(FILTER('Table','Table'[DM_CODE] = _a && 'Table'[price_point] = _b),[Custom.bid_price],",")
mid_price = 
VAR _a = [DM_CODE]
VAR _b = [price_point]
RETURN CONCATENATEX(FILTER('Table','Table'[DM_CODE] = _a && 'Table'[price_point] = _b),[Custom.mid_price],",")

 

4.Copy the table data to Excel and reopen it using Power Query. Then click on 'Split Columns'

vzhouwenmsft_9-1716780770772.png

vzhouwenmsft_10-1716780948860.png

vzhouwenmsft_11-1716780992859.png

vzhouwenmsft_12-1716781045657.png

5.Use the following DAX expression to create a measure

 

Difference_price.1_price.2 = 
VAR _a = SELECTEDVALUE('Table'[bid_price.1])
VAR _b = SELECTEDVALUE('Table'[bid_price.2])
RETURN IF(ISBLANK(_a),-1,IF(_a = _b,0,DIVIDE(_a - _b,_b,1)))

 

6.Final output

vzhouwenmsft_14-1716781259755.png

 

 

 

 

 

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @DTHOMSON198409 ,

The Table data is shown below:

vzhouwenmsft_0-1716780080223.png

Please follow these steps:

1.Adding indexed columns after grouping with Power Query

vzhouwenmsft_1-1716780267193.png

vzhouwenmsft_2-1716780294695.png

vzhouwenmsft_4-1716780459496.png

2.Delete column 'Count', expand column 'Coustom'

vzhouwenmsft_5-1716780563547.png

vzhouwenmsft_6-1716780599950.png

vzhouwenmsft_8-1716780661072.png

3.Use the following DAX expression to create columns

 

bid_price = 
VAR _a = [DM_CODE]
VAR _b = [price_point]
RETURN CONCATENATEX(FILTER('Table','Table'[DM_CODE] = _a && 'Table'[price_point] = _b),[Custom.bid_price],",")
mid_price = 
VAR _a = [DM_CODE]
VAR _b = [price_point]
RETURN CONCATENATEX(FILTER('Table','Table'[DM_CODE] = _a && 'Table'[price_point] = _b),[Custom.mid_price],",")

 

4.Copy the table data to Excel and reopen it using Power Query. Then click on 'Split Columns'

vzhouwenmsft_9-1716780770772.png

vzhouwenmsft_10-1716780948860.png

vzhouwenmsft_11-1716780992859.png

vzhouwenmsft_12-1716781045657.png

5.Use the following DAX expression to create a measure

 

Difference_price.1_price.2 = 
VAR _a = SELECTEDVALUE('Table'[bid_price.1])
VAR _b = SELECTEDVALUE('Table'[bid_price.2])
RETURN IF(ISBLANK(_a),-1,IF(_a = _b,0,DIVIDE(_a - _b,_b,1)))

 

6.Final output

vzhouwenmsft_14-1716781259755.png

 

 

 

 

 

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.