Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi All,
Is there a way of being able to categorise my data into certain months for example, I have data that I want to be able to categorise into 0-12 months and 25-48 months and anything else would be "Other", what would be the quickest way of doing this?
Current Date | 30/09/2019 |
Date | Category |
01/12/2002 | Other |
01/09/2019 | 0-24 |
22/05/2018 | 25-48 |
13/07/2005 | Other |
01/12/2018 | 0-24 |
01/01/2019 | 0-24 |
01/04/2019 | 0-24 |
05/05/2018 | 25-48 |
Solved! Go to Solution.
@UK_User123456 Please add a new column as below
Category = VAR _MonthsDiff = DATEDIFF([Date],TODAY(),MONTH) RETURN IF(_MonthsDiff<=24,"0 -24",IF(_MonthsDiff<=48,"25 - 48","Other"))
Added MonthsDiff column, just for reference.
Proud to be a PBI Community Champion
Hi @UK_User123456 ,
You can also use M query to do it. Here is my test file, you could download and refer to it.
Hi,
I cannot see how you have created the workings as it wont let me update power bi? Are you able to post the working?
Thank you.
Hi @UK_User123456 ,
You could open query editor and find "APPLIED STEPS" in the right part. It shows each step to get the final result.
@UK_User123456 Please add a new column as below
Category = VAR _MonthsDiff = DATEDIFF([Date],TODAY(),MONTH) RETURN IF(_MonthsDiff<=24,"0 -24",IF(_MonthsDiff<=48,"25 - 48","Other"))
Added MonthsDiff column, just for reference.
Proud to be a PBI Community Champion
User | Count |
---|---|
98 | |
91 | |
84 | |
73 | |
67 |
User | Count |
---|---|
115 | |
102 | |
98 | |
71 | |
66 |