Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi,
I need to display the count of fault types for last 1 hour from the maximum datetime from the below dataset:
i tried with the below dax but it is giving incorrect value:
In the below screenshot, the highlighted fault count should not be displayed if we refer the last 1 hour fault type from the table where MOGAlarm is the only fault type the why Healthy is coming:
Please suggest how to do it correctly.
Thanks
Solved! Go to Solution.
By my understanding, you want to count all the categories when their time comes an hour ago, right?
You can use the following formula:
Measure =
VAR _max =
MAXX ( ALL ( 'Table' ), 'Table'[Time] )
RETURN
CALCULATE (
COUNT ( 'Table'[Cate] ),
FILTER ( 'Table', DATEDIFF ( 'Table'[Time], _max, SECOND ) <= 3600 )
)The final output is shown below:
Please take a look at the pbix file here.
Best regards
Qin eyelids
If this post helps, consider ACCEPT as the solution to help other members find it faster.
By my understanding, you want to count all the categories when their time comes an hour ago, right?
You can use the following formula:
Measure =
VAR _max =
MAXX ( ALL ( 'Table' ), 'Table'[Time] )
RETURN
CALCULATE (
COUNT ( 'Table'[Cate] ),
FILTER ( 'Table', DATEDIFF ( 'Table'[Time], _max, SECOND ) <= 3600 )
)The final output is shown below:
Please take a look at the pbix file here.
Best regards
Qin eyelids
If this post helps, consider ACCEPT as the solution to help other members find it faster.
Hello @jitpbi ,
I would suggest divide datetime into 2 calculated columns one with date and one with time.
Date = FORMAT(Fault[DateTime].[Date],"dd/mm/yyyy")
Time = FORMAT(Fault[DateTime],"hh:mm:ss")
Please give datatype as date and time respectively.
Create measure for count as :
FaultTypeCount =
COUNTX(FILTER(Fault,Fault[Date]=MAX(Fault[Date]) && Fault[Time]>=(MAX(Fault[Time])-1/24)),Fault[Fault_type])
If it fulfils your requirement, please mark it as solution.
Thanks!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 48 | |
| 40 | |
| 39 | |
| 20 | |
| 16 |
| User | Count |
|---|---|
| 70 | |
| 67 | |
| 32 | |
| 27 | |
| 25 |