Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi
I'm trying to solve what i think should be a pretty simple problem, but it's beating me!
I'm trying to create a calculated column which basically returns whether a date is the "latest" month or it's the "previous" month.
I have the below code which doesn't work because the previousmonth function needs to reference a column. Does anyone have any ideas how to work around this??
Solved! Go to Solution.
@Anonymous
Try this code - I just tweaked your original code, but you need to add one more calculated column called PrevMonth. Check this out.
1.
Prev Month = PREVIOUSMONTH(Date_table[Month_end])
2.
Month Marker = if(Date_table[Month_end] = MAX(Date_table[Month_end]), "Latest", if(Date_table[Month_end] = max(Date_table[Prev Month]), "Previous","NA"))
Let me know if this works for you. Many Thanks
@Manoj_Nair many thanks. I'd actually tried this previously and it didn't work, but clearly i'd made a mistake somewhere and on second go it works perfectly!
Unfortunately i can't use the today function as the dates i'm using are month end dates. So for instance my latest dates in the column are currently 31/12/2022 and 30/11/2022. I would like to mark the December date as "Latest" and the November date as "Previous"
Provide some sample data(by removing sensitive data), so that its easy to get betetr answers..
So i'm trying to achieve this
Month end | Month marker |
30/09/2022 | NA |
31/10/2022 | NA |
30/11/2022 | Previous |
31/12/2022 | Latest |
@Anonymous
Try this code - I just tweaked your original code, but you need to add one more calculated column called PrevMonth. Check this out.
1.
Prev Month = PREVIOUSMONTH(Date_table[Month_end])
2.
Month Marker = if(Date_table[Month_end] = MAX(Date_table[Month_end]), "Latest", if(Date_table[Month_end] = max(Date_table[Prev Month]), "Previous","NA"))
Let me know if this works for you. Many Thanks
User | Count |
---|---|
84 | |
75 | |
73 | |
42 | |
36 |
User | Count |
---|---|
114 | |
56 | |
52 | |
43 | |
42 |