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

Preparing for a certification exam? Ask exam experts all your questions on May 15th. Register now.

Reply
Anonymous
Not applicable

Best way to model this data?

I have data similar to the following on the left. Where the values are listed under the date column for which they are incurred. It is extremely disorganized and hard to create DAX formulas with the data like that. 

 

My question is would making the data on the left look like the data on the right be the best way to model such data? If not what would be an alternative? If that is the best way, what would be the best way to make sure the transformed data still has a primary key? Create another column with concatenated values to create a unique id?

 

Would this have any implications on load times?

 

Finally, if this is the best way to transform the data, would it simply be to unpivot all the date columns?

 

data transform example.PNG

 

Thank you in advance for any help!

1 ACCEPTED SOLUTION
v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

You are right, the best way is to use Unpivot feature, select on the remain columns except these Date  columns, right click to choose option "Unpivot other columns", then rename the result column "Attribute" with "date", don't forget click button "Close & Apply".

 

In addition,  Unpivot feature won't have influence with the Primary Key.

 

Generally, the Primary key is created/defined at data source level and then import it into Power BI.  Also you may use DAX in Power BI Desktop to combine several columns so that each row has unique values, like DAX below.

 

 

Primary Key= [Column1]&" "&[Column2]



Primary Key= CONCATENATE([Column1], [Column2])

 

 

Best Regards,

Amy 

 

Community Support Team _ Amy

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

View solution in original post

2 REPLIES 2
v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

You are right, the best way is to use Unpivot feature, select on the remain columns except these Date  columns, right click to choose option "Unpivot other columns", then rename the result column "Attribute" with "date", don't forget click button "Close & Apply".

 

In addition,  Unpivot feature won't have influence with the Primary Key.

 

Generally, the Primary key is created/defined at data source level and then import it into Power BI.  Also you may use DAX in Power BI Desktop to combine several columns so that each row has unique values, like DAX below.

 

 

Primary Key= [Column1]&" "&[Column2]



Primary Key= CONCATENATE([Column1], [Column2])

 

 

Best Regards,

Amy 

 

Community Support Team _ Amy

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

Ashish_Mathur
Super User
Super User

Hi,

In the Query Editor, select the first 3 columns > right click > Unpivot other columns.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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