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
Kureigu
Frequent Visitor

Add Multiple Values in Column per ID

Hi,

 

I have a table of IDs that derive from another table, I need to add a list of values for each ID (years) so that I can summarise data into a table for each year. The years are as a list in another table. Can do this either in PowerQuery or PowerBi, whichever makes sense... (I assumed the former, but haven't had any luck with either so far).

 

Essentially I have this:

ID
1
2
3
4
5
6
7
8
9

 

And i need this:

IDAY
12017
12018
12019
12020
22017
22018
22019
22020
32017

 

I assumed it'd be easy, I've found a lot of DAX to be fairly straight forward so far... But apparently not!

Any help would be greatly appreciated.

C

2 ACCEPTED SOLUTIONS
parry2k
Super User
Super User

@Kureigu it will be easier to do in PQ, merge your ID table with the 2nd table which has the year on the ID column, and after the merge step, expand the column you just created and you will get all the years for each ID.

 

Something like this:

 

parry2k_0-1611446011476.png

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

 

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

sanalytics
Solution Supplier
Solution Supplier

Hello @Kureigu ,

 

Create an additional column and do cross join.

 

Refer the pbix file on below link

 

https://dropfiles.org/rEba7WTm

 

Regards

sanalytics

If it is your solution then please like and accept it as your solution

View solution in original post

5 REPLIES 5
parry2k
Super User
Super User

@sabilahmed what is the final output you are looking for?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Kureigu
Frequent Visitor

Thanks guys, I really appreciated it... I seriously doubt I would've been able to discover that solution without your help.

sanalytics
Solution Supplier
Solution Supplier

Hello @Kureigu ,

 

Create an additional column and do cross join.

 

Refer the pbix file on below link

 

https://dropfiles.org/rEba7WTm

 

Regards

sanalytics

If it is your solution then please like and accept it as your solution

parry2k
Super User
Super User

@Kureigu it will be easier to do in PQ, merge your ID table with the 2nd table which has the year on the ID column, and after the merge step, expand the column you just created and you will get all the years for each ID.

 

Something like this:

 

parry2k_0-1611446011476.png

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

 

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hello @parry2k 

 

Great solution. I was attempting somethjing similar with my example data set:

 

Table 1:

 

Product IDLifespan (Years)Activation yearPurchase value
400502011£500
401501975£10,000
402501950£12,000
403302010£50,000
404402020

£40,000

 

 

Table 2:

 

Year
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986

 

But there is no ID against the Year column in table 2. So how can I create the merge with the ID relationship. I need the exact same output in your solution buit can't do it without the ID key to connect the two.

 

Hoppe that makes sense.

 

S

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.