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 All,
We have a DimDate table which is our Date Dimension table. We have a Incident_Detail data table which contains following date column(s):
1) Created_Date
2) Cancelled_Date
3) Resolved_Date
4) Closed_Date
5) Re Opened_Date
6) Open_Date
Now we created relationship between DimDate[Date] to All the dates columns available in the Incident_Detail Table. We have active relationship with Created_Date. We need to create a measure that includes both Created_Date & Resolved_Date
Below is the Pseudo code for the measure:
Total Open Incident=
IF(Created_DateKey<=Reporting_Date,
(IF(OR(state="On Hold",state="In Progress",Resolved_Datekey>=Reporting_Date),
count(Incident),0)),(0))
Note- Reporting_Date is the slicer value from DimDate[Date]
Could you please help us in writing the DAX measure for above Pseudo code
Thanks,
PBI V2
Solved! Go to Solution.
Hi,
Thanks for the solution @aduguid provided, and i want to offer some more infotmation for user to refer to.
hello @PBI_V2 , you can create a measure.
Total Open Incident =
VAR a =
MAX ( DimDate[Date] )
RETURN
CALCULATE (
COUNTROWS ( Incident_Detail ),
Incident_Detail[Created_Date] <= a,
OR (
Incident_Detail[state] IN { "On Hold", "In Progress" },
Incident_Detail[Resolved_Date] >= a
),
CROSSFILTER ( DimDate[Date], Incident_Detail[Created_Date], NONE )
)
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Total Open Incident =
VAR Reporting_Date = MAX(DimDate[Date]) // Assuming you want to use the maximum date selected in the slicer
RETURN
CALCULATE(
COUNTROWS(Incident_Detail),
Incident_Detail[Created_Date] <= Reporting_Date,
OR(
Incident_Detail[state] = "On Hold",
Incident_Detail[state] = "In Progress",
Incident_Detail[Resolved_Date] >= Reporting_Date
),
USERELATIONSHIP(DimDate[Date], Incident_Detail[Created_Date]) // Establishing the relationship to Created_Date
)
Hi,
Thanks for the solution @aduguid provided, and i want to offer some more infotmation for user to refer to.
hello @PBI_V2 , you can create a measure.
Total Open Incident =
VAR a =
MAX ( DimDate[Date] )
RETURN
CALCULATE (
COUNTROWS ( Incident_Detail ),
Incident_Detail[Created_Date] <= a,
OR (
Incident_Detail[state] IN { "On Hold", "In Progress" },
Incident_Detail[Resolved_Date] >= a
),
CROSSFILTER ( DimDate[Date], Incident_Detail[Created_Date], NONE )
)
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello @v-xinruzhu-msft
Thanks for your response. We are getting the below error message with the formula provided by you.
CROSSFILTER function can only use the two column references participating in a relationship.
Thanks,
PBI V2
Hi @PBI_V2
Please make sure that the relationship between created_date and calendar date is active, and the created_date and calendar date shold be put in the crossfilter() function.if it still cannot work, can you show the code you have created?
Best Regards!
Yolo Zhu
Hello @v-xinruzhu-msft
We have active relationship beween DimDate[Date] & Incident_Detail[Created_Date]. Below is the screenhsot:
Below is the actual code
Thanks,
PBI V2
Hi @PBI_V2 ,
Thanks for your quick reply, the code you created is different from the code i have offered, you can copy the code i offered, and try it.
Best Regards!
Yolo Zhu
Hello @v-xinruzhu-msft
Your Code is working. We are validating the data.. We will update you soon.
Thanks,
PBI V2
Hello @aduguid ,
We have tried the latest formula provided by you. It is giving the below error when we add the measure to Visual:
Thanks,
PBI V2
Give this a try
Total Open Incident =
CALCULATE (
COUNTROWS ( Incident_Detail ),
FILTER (
Incident_Detail,
Incident_Detail[Created_Date] <= MAX ( DimDate[Date] ) &&
(
Incident_Detail[state] = "On Hold" ||
Incident_Detail[state] = "In Progress" ||
Incident_Detail[Resolved_Date] >= MAX ( DimDate[Date] )
)
)
)
Hello @aduguid ,
Thanks for your response. we have validated the data after applying the formula provided by you. It looks like Resolved_Date condition is not working beause it is an inactive relationship.
Total Open Incident =
CALCULATE (
COUNTROWS ( Incident_Detail ),
FILTER (
Incident_Detail,
Incident_Detail[Created_Date] <= MAX ( DimDate[Date] ) &&
(
Incident_Detail[state] = "On Hold" ||
Incident_Detail[state] = "In Progress" ||
Incident_Detail[Resolved_Date] >= MAX ( DimDate[Date] )
)
)
)
We tried USERELATIONSHIP
But it is giving below error:
Operator or expression '( )' is not supported in this context.
Thanks,
PBI V2
My apologies, try this one
Total Open Incident =
CALCULATE (
COUNTROWS ( Incident_Detail ),
FILTER (
Incident_Detail,
Incident_Detail[Created_Date] <= MAX ( DimDate[Date] ) &&
(
Incident_Detail[state] = "On Hold" ||
Incident_Detail[state] = "In Progress" ||
Incident_Detail[Resolved_Date] >= MAX ( DimDate[Date] )
)
),
USERELATIONSHIP ( Incident_Detail[Resolved_Date], DimDate[Date] )
)
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 |
---|---|
143 | |
85 | |
66 | |
51 | |
45 |
User | Count |
---|---|
216 | |
89 | |
82 | |
66 | |
57 |