The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I have some incident data, and I need to count the number of days since any of the following have occurred: first aid, recordable, and lost time. I would like to use a card to display the total number of days since any of these have occurred. There are some incidents in the column, such as near misses, that I do not want to count. Basically I would like the first aids, recordables, and lost times to be aggregated so that if any of them occur, the total safe days reset to zero. My understanding is that I can use a DAX expression using DATEDIFF, but I can only figure out how to count the days between one value, not all three.
Ultimately, I want to have one count for maintenance "safe days" and another count for construction "safe days." I have some sample data shown below to demonstrate the columns I have.
Solved! Go to Solution.
@ld17 Maybe:
Measure =
VAR __Today = TODAY()
VAR __Last = MAX('Table'[Date of Incident])
RETURN
( __Today - __Last ) * 1.
@ld17 Maybe:
Measure =
VAR __Today = TODAY()
VAR __Last = MAX('Table'[Date of Incident])
RETURN
( __Today - __Last ) * 1.
Thank you for this! While this gives me the number of days since the last incident overall, I am still having trouble figuring out how to narrow it down to only the criteria I need (first aids, recordables, and lost times) and not just every incident that gets inputted on our log. I also only need it for the two departments: maintenance and construction.
@ld17 Well generally that would be done by putting your columns for that into some kind of visualization and thereby filtering the underlying table. But, you could also use MAXX(FILTER(...),...) when getting your __Last and thus hard code your filtering criteria if necessary.
Ah, that makes sense. I was being dumb and overthinking that. That works. Thanks so much!
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
21 | |
19 | |
18 | |
16 | |
13 |
User | Count |
---|---|
39 | |
38 | |
23 | |
21 | |
20 |