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
mb0307
Responsive Resident
Responsive Resident

Monthly data in multiple columns or single

Hi all,

 

Just a data queries before I start the modelling work in power bi.

 

I receive the Sales data in multi-columns format (horizontal) like this:

Jan |Feb |Mar |Apr |May |Jun |...... Keeps on expanding

 

and the columns keeps on increasing/decreasing based on previous/current/future years - which might be a problem for dax as it will require updating each time a column is add or dropped? 

 

Is it a best practice (and keeping in mind that all the DAX i may write for calculations) to transpose the data into one column, like this:

Jan
Feb
Mar
Apr
May
Jun
..... Keeps on expanding

 

 

Thoughts please..

 

Thanks

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@mb0307 - In general, yes, 9 times out of 10 you want to unpivot those month columns. Difficult to be 100% sure without more detail but almost certainly yes.


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
mhossain
Solution Sage
Solution Sage

@mb0307 

 

Agree with @Greg_Deckler  , unpivoting your data will make your calculation/DAX easier and better.

pranit828
Community Champion
Community Champion

HI @mb0307 

For the best outcome and also to use year into consideration and keeping the number of columns constant, it is best to unpivot and use it in the way you have described. You are on the right track.





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile
Greg_Deckler
Super User
Super User

@mb0307 - In general, yes, 9 times out of 10 you want to unpivot those month columns. Difficult to be 100% sure without more detail but almost certainly yes.


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.