The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi All, I am having some issues with how to approach my query so any help would be greatly appreciated.
I have a date column that I need to increase based on two other columns values.
e.g. Date Reported column - 17/12/2018
If my Impact Column = "Urgent" and my Department = "Stores" I would need to increase my Date Reported Column to 18/12/2018
However if my Impact Column = "Standard" and my Department = "Floor" I would need to increase my Date Reported Column to 20/12/208
I would ideally like to not touch the original Date Reported Column but move this new value to another column.
So Far I have created a custom column and this is my code however it doesnt work.
AmendedDateReported = if(And(SurveyCorrectiveAction[Impact] = "Urgent", SurveyCorrectiveAction[LookUp] = "Stores"), Date.AddDays([DateReported],1),Blank ())
Thanks
Paula
Solved! Go to Solution.
@PaulaL,
If you create a custom column in Power BI Desktop query editor, please use formula below.
if [Impact] = "Urgent" and [LookUp] = "Stores" then Date.AddDays([DateReported],1) else if [Impact] = "Standard" and [LookUp] = "Floor" then Date.AddDays([DateReported],3) else null
If you create a calcualted column, please using DAX below.
Column = if (and(SurveyCorrectiveAction[Impact] = "Urgent", SurveyCorrectiveAction[LookUp] = "Stores") ,SurveyCorrectiveAction[DateReported]+1 ,if(and(SurveyCorrectiveAction[Impact] = "Standard" , SurveyCorrectiveAction[LookUp] = "Floor" ), SurveyCorrectiveAction[DateReported]+3,BLANK()))
Regards,
Lydia
@PaulaL,
If you create a custom column in Power BI Desktop query editor, please use formula below.
if [Impact] = "Urgent" and [LookUp] = "Stores" then Date.AddDays([DateReported],1) else if [Impact] = "Standard" and [LookUp] = "Floor" then Date.AddDays([DateReported],3) else null
If you create a calcualted column, please using DAX below.
Column = if (and(SurveyCorrectiveAction[Impact] = "Urgent", SurveyCorrectiveAction[LookUp] = "Stores") ,SurveyCorrectiveAction[DateReported]+1 ,if(and(SurveyCorrectiveAction[Impact] = "Standard" , SurveyCorrectiveAction[LookUp] = "Floor" ), SurveyCorrectiveAction[DateReported]+3,BLANK()))
Regards,
Lydia
@v-yuezhe-msftThank you very much for this, will it also work if I need to add multiple other impacts and departments? if I expand the else if?
@PaulaL,
It should work. If you get any issues using above formula, you can post back with sample data and expected result.
Regards,
Lydia
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
114 | |
78 | |
77 | |
47 | |
38 |
User | Count |
---|---|
147 | |
115 | |
65 | |
64 | |
53 |