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,
So I am using a Direct Query to bring in some inspection information for catch basins. Basically I have two tables; one with all of our catchbasins (id of each one = FACILITYID) and another with inspection information. My query joins the two tables on FACILITYID and then shows all of the catchbasins along with the most recent inspection date (INSP_DATE). If there is no inspection done on it yet, the INSP_DATE is null.
SELECT works.SSCATCHBASIN.FACILITYID, Max(works.INSPECTIONS_CATCHBASIN_INSPECTION.INSP_DATE) AS MaxOfINSP_DATE, works.SSCATCHBASIN.DEPOTAREA
FROM works.SSCATCHBASIN LEFT JOIN works.INSPECTIONS_CATCHBASIN_INSPECTION ON works.SSCATCHBASIN.FACILITYID = works.INSPECTIONS_CATCHBASIN_INSPECTION.FACILITYID
GROUP BY works.SSCATCHBASIN.FACILITYID, works.SSCATCHBASIN.LIFECYCLESTATUS, works.SSCATCHBASIN.DEPOTAREA
HAVING (((works.SSCATCHBASIN.LIFECYCLESTATUS)='ASSUMED' Or (works.SSCATCHBASIN.LIFECYCLESTATUS)='ISSUED FOR CONSTRUCTION' Or (works.SSCATCHBASIN.LIFECYCLESTATUS)='MAINTENANCE'));
So the end table is basically all catchbasins with the most recent inspection, with a NULL date for those with no inspection.
One problem I am having is that I cannot create a date hierarchy of MaxOfINSP_DATE field. It's showing up as a valid Date/Time field in the Power Query Editor. From what I've read this might be an issue with Direct Query, but I'm not totally sure.
I'd like to do this since I need to create a % inspected visual and I figure this would be the easiest way to do it. So for 2022, all catchbasins inspected in either 2022 or 2021 would be considered "inspected" and everything else (including NULL date) would be considered "uninspected".
Hopefully that makes sense.
I am a total newbie to Power BI, so please be gentle with me so perhaps my logic to this is totally wrong. 🙂
Solved! Go to Solution.
OMG! I finally go this to work. So I added 3 measures; 1 for CatchBasin count (CB_Count), 1 for the Inspection count (INSP_Count) and 1 to calculate the % completed (PercentComplete).
This only took me about 3 days!! LOL
OMG! I finally go this to work. So I added 3 measures; 1 for CatchBasin count (CB_Count), 1 for the Inspection count (INSP_Count) and 1 to calculate the % completed (PercentComplete).
This only took me about 3 days!! LOL
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.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 48 | |
| 43 | |
| 39 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 69 | |
| 63 | |
| 32 | |
| 30 | |
| 23 |