March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe 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
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.
Solved! Go to Solution.
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.
(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))
(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")
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.
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.
(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))
(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")
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.
Step 0: I use these data.
"PreviousMonth" Table
"ThisMonth" Table
Step 1: I do "Merge Queries as New" to "PreviousMonth" Table on Power Query Editor.
Step 2: I add a "Conditional" column below.
Step 3: I remove the "ThisMonth.Names" column and change a type of "Custom" column to "Text".
Step 4: I do same procedure to "ThisMonth" Table.
Step 5: I do "Append Queries as New" to the "Merge1" Table and the "Merge2" Table.
Step 6: I remove duplicates.
Step 6: I make a table.
Thanks alot mickey64, really appreciate the reply.
could you pls provide some sample data and expected output?
Proud to be a Super User!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |