Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
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
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
21 | |
15 | |
14 | |
11 | |
7 |
User | Count |
---|---|
25 | |
24 | |
12 | |
12 | |
11 |