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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
hmil
Frequent Visitor

Joining columns into Fewer columns and multiple rows

Is it possible to manipulate a table in Power BI from this:

 

DATE  LOCA-QUALA    LOCA-QUALB   LOCA-QUALC   LOCB-QUALA   LOCB-QUALB   LOCB-QUALC

1/01   0.1                     0.2                     0.3                    0.4                    0.5                    0.6

1/02   0.7                     0.8                     0.9                    1.0                    1.1                    1.2

 

Desired:

DATE Location QualityA  QualityB  QualityC

1/01   A            0.1           0.2           0.3

1/01   B            0.4           0.5           0.6 

1/02   A            0.7           0.8           0.9

1/02   B            1.0           1.1           1.2

 

I need to be able to isolate the Location Value from the Columns to its own column and I am unsure on how to do so.

Thank you!

1 ACCEPTED SOLUTION

Ok, had a look, you want this option below:

 

Capture.JPG

 

Highlight all columns except the data and pivot, you'll then have to extract the info from the "Attribute" column name strings.

 

Give me a shout if you don't know how to do this.

 

 

View solution in original post

3 REPLIES 3
Ruksuro
Helper III
Helper III

If this data is sourced from TSQL (or some other manipulatable source) I would be inclined to select each column individually and perform a union of each select:

 

Select

   Date,

   'A' as Location,

   LOCA-QUALA as QualityA, 

   LOCA-QUALB as QualityB,   

   LOCA-QUALC as QualityC

from [Table]

 

union all

 

Select

   Date,

   'B' as Location,

   LOCB-QUALA as QualityA, 

   LOCB-QUALB as QualityB,   

   LOCB-QUALC as QualityC

from [Table]

 

 

However I might take this a step further:

 

Select

   Date,

   'A' as Location,

   'A' as Quality,

   LOCA-QUALA as [Metric], 

from [Table]

 

union all

 

Select

   Date,

   'A' as Location,

   'B' as Quality,

   LOCA-QUALB as [Metric], 

from [Table]

 

union all

 

[etc]

 

If you can't manipulate in this way and it has to be PowerBI let me know and I'll give it a go,

 

This is the trouble with storing dimension information in the field name...

 

Ok, had a look, you want this option below:

 

Capture.JPG

 

Highlight all columns except the data and pivot, you'll then have to extract the info from the "Attribute" column name strings.

 

Give me a shout if you don't know how to do this.

 

 

hmil
Frequent Visitor

Got it Thank you!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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