Forum Discussion

avidthinker's avatar
avidthinker
Frequent Visitor
2 years ago
Solved

Getting records in Power Query/SQL for missing data

I have data from a table in SQL that reports telemetry   Product        Reporting Date A                  05/02/2024 A                  04/02/2024   I want to against a date table return   Pr...
  • talespin's avatar
    2 years ago

    hi avidthinker ,

     

    I hope this is what you are looking for. In my setup, I have a Date table and a Fact table. I have created a column in my Date table "IsValid", I set it to 1 if date exists in Fact Table else 0. Data is on the right side table visual in screenshot below. 

    Calculated Column

    IsValid =
    VAR _SelDate = [Date]
    VAR _IsValid = CALCULATE( MAX(QtyTbl[Inventory date]), QtyTbl[Inventory date] = _SelDate)
    RETURN IF( ISBLANK(_IsValid), 0 , 1)
     
    Measure 
    TestMeasure =
    VAR _SelDt = SELECTEDVALUE('CALENDAR'[Date])
    VAR _IsValid = CALCULATE( VALUES('CALENDAR'[IsValid]), 'CALENDAR'[Date] = _SelDt)

    RETURN IF(_IsValid = 1, "Report Exists", "No Report")