Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hello folks,
I am trying to create a column to create a flag (FlagColumn) which is to have the below logic.
If any of the Date1 or Date2 happened in the previous month, then Previous.
If no Dates then NoFlag
I tried using between start of month and EOmonth etc, but doesnt work.
Any recommendations please
PersonId | Date1 | Date2 | FlagColumn |
A123 | 11/1/23 | CurrentMonth | |
A234 | NoFlag | ||
A456 | 1/1/23 | 3/3/23 | Earlier |
A567 | 6/1/23 | 6/2/23 | Earlier |
A678 | 8/1/23 | 10/1/23 | Previous |
A789 | 10/2/23 | 10/4/23 | Previous |
Solved! Go to Solution.
Hi @PBI5851 ,
You can use the below DAX in a new measure:
Flag =
SWITCH(
TRUE(),
MAX('Table'[Date1]) = BLANK() && MAX('Table'[Date2]) = BLANK(), "No Flag",
MONTH(MAX('Table'[Date1])) = MONTH(TODAY()) || MONTH(MAX('Table'[Date2])) = MONTH(TODAY()), "Current Month",
MONTH(MAX('Table'[Date1])) = MONTH(TODAY()) - 1 || MONTH(MAX('Table'[Date2])) = MONTH(TODAY()) - 1, "Previous Month",
"Earlier"
)
Give a Thumbs Up if this post helped you in any way and Mark This Post as Solution if it solved your query !!! Proud To Be a Super User !!! |
Hi @PBI5851 ,
You can use the below DAX in a new measure:
Flag =
SWITCH(
TRUE(),
MAX('Table'[Date1]) = BLANK() && MAX('Table'[Date2]) = BLANK(), "No Flag",
MONTH(MAX('Table'[Date1])) = MONTH(TODAY()) || MONTH(MAX('Table'[Date2])) = MONTH(TODAY()), "Current Month",
MONTH(MAX('Table'[Date1])) = MONTH(TODAY()) - 1 || MONTH(MAX('Table'[Date2])) = MONTH(TODAY()) - 1, "Previous Month",
"Earlier"
)
Give a Thumbs Up if this post helped you in any way and Mark This Post as Solution if it solved your query !!! Proud To Be a Super User !!! |
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
114 | |
107 | |
98 | |
39 | |
34 |
User | Count |
---|---|
151 | |
122 | |
76 | |
74 | |
50 |