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.
Hello Team
Need your help on the below
I have 2 Tables, one includes Dates, Revised Due Date
Second is a Calender table Used to define my Selected-Date=SelectedValue(Calender[Date])
Need to Calculate the Date Diff. If Revised Due Date is Blank then DateDiff is between Date and Selected Date otherwise it will be Revised Due Date and Selected Date.
Am using a Column with sumx but only managing to get the sum of the DateDiff with Revised Due Date
Solved! Go to Solution.
Hi @Herchris7172 ,
Here are the steps you can follow:
1. Create measure.
Measure =
var _select=SELECTEDVALUE('Calender'[Date])
var _if=
IF(
MAX('Table'[Revised Due Date]) = BLANK(),
DATEDIFF(
MAX('Table'[Date]),_select,DAY),
DATEDIFF(
MAX('Table'[Revised Due Date]),_select,DAY))
return
DIVIDE(ABS(_if) ,30)
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @Herchris7172 ,
Here are the steps you can follow:
1. Create measure.
Measure =
var _select=SELECTEDVALUE('Calender'[Date])
var _if=
IF(
MAX('Table'[Revised Due Date]) = BLANK(),
DATEDIFF(
MAX('Table'[Date]),_select,DAY),
DATEDIFF(
MAX('Table'[Revised Due Date]),_select,DAY))
return
DIVIDE(ABS(_if) ,30)
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Another way I found out is this
Thanks for the reply from @lbendlin , please allow me to provide another insight:
Hi @Herchris7172 ,
Here are the steps you can follow:
1. Create measure.
Test =
var _select=SELECTEDVALUE('Calender'[Date])
var _table=
ADDCOLUMNS(
ALL('Table'),"Datediff",
IF(
'Table'[Revised Due Date] = BLANK(),
DATEDIFF(
'Table'[includes Dates],_select,MONTH),
DATEDIFF(
'Table'[Revised Due Date],_select,MONTH)))
return
SUMX(
_table,[Datediff])
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Thanks for the Reply but am Expecting results like the below. This is in Excel
Read about how to use COALESCE to test for BLANK() and replace it with other values like "TODAY()".
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 |
---|---|
18 | |
15 | |
12 | |
11 | |
8 |
User | Count |
---|---|
24 | |
19 | |
12 | |
11 | |
10 |