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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Tobz007
Frequent Visitor

How to Create A Dynamic List from a String Column

I have a table (lets call it "Table") that contains "Names", "Date" and other info for the Names, every month a new list is appended to the Table to show the names and updated information, sometimes the appended table contains same name from last month, sometimes it contains some new names and sometimes some names from previous month is removed, how do I create power query steps (or DAX) that;
1. Creates a list which comprises of the names from the previous month in the Table.
2. Based on the list, if a name from the previous month list no longer exist in current month, it returns A, if name that does not exist in previous month is added in current month it returns B, else C.

1 ACCEPTED SOLUTION
v-tangjie-msft
Community Support
Community Support

Hi @Tobz007 ,

 

Thanks to mickey64  and ryan_mayu  for their quick replies. I have a DAX method to add:

(1) This is my table. It contains data for this month and last month.

vtangjiemsft_3-1726215237089.png

 

(2) We can create a [Previous month] table.

Previous month = 
var _month=MONTH(MAXX(ALL('Table'),[Date]))-1
RETURN CALCULATETABLE(VALUES('Table'[Name]),FILTER('Table',MONTH([Date])=_month))

vtangjiemsft_1-1726215098817.png

(3) We can create a table and a status column.

Table 2 = VALUES('Table'[Name])
Status = 
var _month=MONTH(MAXX(ALL('Table'),[Date]))
var _table= CALCULATETABLE(VALUES('Table'[Name]),FILTER('Table',MONTH([Date])=_month))
var _table_a=EXCEPT('Previous month',_table)
var _table_b=EXCEPT(_table,'Previous month')
RETURN SWITCH(TRUE(),
[Name] in _table_a,"A",
[Name] in _table_b,"B",
"C")

vtangjiemsft_2-1726215178756.png

 

Best Regards,

Neeko Tang

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

5 REPLIES 5
v-tangjie-msft
Community Support
Community Support

Hi @Tobz007 ,

 

Thanks to mickey64  and ryan_mayu  for their quick replies. I have a DAX method to add:

(1) This is my table. It contains data for this month and last month.

vtangjiemsft_3-1726215237089.png

 

(2) We can create a [Previous month] table.

Previous month = 
var _month=MONTH(MAXX(ALL('Table'),[Date]))-1
RETURN CALCULATETABLE(VALUES('Table'[Name]),FILTER('Table',MONTH([Date])=_month))

vtangjiemsft_1-1726215098817.png

(3) We can create a table and a status column.

Table 2 = VALUES('Table'[Name])
Status = 
var _month=MONTH(MAXX(ALL('Table'),[Date]))
var _table= CALCULATETABLE(VALUES('Table'[Name]),FILTER('Table',MONTH([Date])=_month))
var _table_a=EXCEPT('Previous month',_table)
var _table_b=EXCEPT(_table,'Previous month')
RETURN SWITCH(TRUE(),
[Name] in _table_a,"A",
[Name] in _table_b,"B",
"C")

vtangjiemsft_2-1726215178756.png

 

Best Regards,

Neeko Tang

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

Thanks alot v-tangjie-msft, I did found a way around the solution using power query, but your feedback is quite helpful! Thanks again.

mickey64
Super User
Super User

Step 0: I use these data.

"PreviousMonth" Table

mickey64_0-1726150816176.png

 

"ThisMonth" Table

mickey64_1-1726150831701.png

 

Step 1: I do "Merge Queries as New" to "PreviousMonth" Table on Power Query Editor.

mickey64_2-1726150979699.png

 

mickey64_3-1726151036878.png

 

Step 2: I add a "Conditional" column below.

mickey64_4-1726151081828.png

 

mickey64_5-1726151116425.png

 

Step 3: I remove the "ThisMonth.Names" column and change a type of "Custom" column to "Text".

mickey64_9-1726151454951.png

 

Step 4: I do same procedure to "ThisMonth" Table.

mickey64_8-1726151420483.png

 

Step 5: I do "Append Queries as New" to the "Merge1" Table and the "Merge2" Table.

mickey64_10-1726151613056.png

 

Step 6: I remove duplicates.

mickey64_11-1726151667873.png

 

Step 6: I make a table.

mickey64_12-1726151705812.png

 

Thanks alot mickey64, really appreciate the reply.

ryan_mayu
Super User
Super User

could you pls provide some sample data and expected output?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.