The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I have a column "Mode" which has multiple values; A, B, C & D. I need to calculate date difference in days, as per below condition:
If Mode = "A" or "B" , calculate ([Date1] - [Date2]), else
If Mode = "C" or "D" calculate ([Date3] - [Date4])
Please help.
Thanks,
Muralidhar
Solved! Go to Solution.
@murali5431
Add the following as a column,
New Column =
IF ( [Mode] = "A" || [Mode] = "B", DATEDIFF([Date1] , [Date2],DAY), IF( [Mode] = "C" || [Mode] = "D",DATEDIFF([Date3] , [Date4],DAY)))
________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@murali5431 , Try like
Switch (true(),
[Mode] in { "A" ,"B"}, datediff([Date1],[Date2],day),
[Mode] in { "C" ,"D"}, datediff([Date3] , [Date4],DAY)
)
@murali5431 , Try like
Switch (true(),
[Mode] in { "A" ,"B"}, datediff([Date1],[Date2],day),
[Mode] in { "C" ,"D"}, datediff([Date3] , [Date4],DAY)
)
@murali5431
Add the following as a column,
New Column =
IF ( [Mode] = "A" || [Mode] = "B", DATEDIFF([Date1] , [Date2],DAY), IF( [Mode] = "C" || [Mode] = "D",DATEDIFF([Date3] , [Date4],DAY)))
________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
User | Count |
---|---|
28 | |
12 | |
8 | |
7 | |
5 |
User | Count |
---|---|
34 | |
15 | |
12 | |
7 | |
6 |