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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.