Forum Discussion

Tobz007's avatar
Tobz007
Frequent Visitor
1 year ago
Solved

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 ...
  • Anonymous's avatar
    Anonymous
    1 year ago

    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.