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.
Hi,
I have spent some time googling this but maybe not asking the question correctly to find the information....
Anyway what I am trying to do is as followings
TABLE A
From this table create a list from a Date column that containts all the unique dates.
Table B
In this Table I want to add a new column that containts the list generated from Table A
Col A | Col B | NEW COL |
Fact 1 | Fact 1 | Table A - List |
Fact 2 | Fact 2 | Table A - List |
Once I have this I can then expand the list... so I end up with a table with rows that repeats Fact 2 for all the dates and the same for Fact 2
Col A | Col B | NEW COL |
FACT 1 | FACT 1 | 01/01/2020 |
FACT 1 | FACT 1 | 08/01/2020 |
FACT 2 | FACT 2 | 01/01/2020 |
FACT 2 | FACT 2 | 08/01/2020 |
I have unsucessfully tried a number of approaches that keep coming up with errors like
So the question is does anyone know how to do this?
Thanks in advance
Solved! Go to Solution.
Writing code in the advanced editor is an option but it wouldn't be my first thought.
Use the 'Add Column' tab in the editor.
I'm not going to write the line for you as you're nearly there.
@Timaru_Golf use CROSSJOIN DAX function to get the expected result.
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos 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.
Sorry forgot to mention this is within M code
Writing code in the advanced editor is an option but it wouldn't be my first thought.
Use the 'Add Column' tab in the editor.
I'm not going to write the line for you as you're nearly there.
Thanks I was over thinking it - works a treat.
// Create Unique DATE column
#"Removed Other Columns1" = Table.SelectColumns(#"Remove KEY",{"Report Date"}),
#"Report Date" = Table.Distinct(#"Removed Other Columns1"),
// Create Fact table expanded by Dates
#"Removed Other Columns" = Table.SelectColumns(#"Remove KEY",{"COUNTRY", "CustomerName", "CustomerNumber", "Class"}),
#"Removed Duplicates1" = Table.Distinct(#"Removed Other Columns"),
#"Added Custom1" = Table.AddColumn(#"Removed Duplicates1", "Custom", each #"Report Date"),
#"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom1", "Custom", {"Report Date"}, {"Report Date"}),
Don't know what TableA (does it already have unique dates?) looks like but this should work
In Table B, Add a custom column with the code
TableA[thedatecolumn]
Yes Table A is just a single column of unique dates.
So it how I add this as a new column - my code looks like this -- having a problem with what I would put in the last line
// Create Unique DATE column
#"Removed Other Columns1" = Table.SelectColumns(#"Remove KEY",{"Report Date"}),
#"Report Date" = Table.Distinct(#"Removed Other Columns1"),
// Create Fact table expanded by Dates
#"Removed Other Columns" = Table.SelectColumns(#"Remove KEY",{"COUNTRY", "CustomerName", "CustomerNumber", "Class"}),
#"Removed Duplicates1" = Table.Distinct(#"Removed Other Columns"),
#"Added Custom" = Table.AddColumn(XXXXXXX),
Thanks
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |