Forum Discussion

Sankzpower's avatar
Sankzpower
Helper I
6 years ago
Solved

Missing dates visibility in a table/Visual

Hi Guys   A very strange one for me. I have tried different solutions such as counting the days between from and to but none of seem it work. Below is my dataset. Ultimately, I would like Power bi ...
  • lc_finance's avatar
    6 years ago

    Hi Sankzpower ,

     

     

    you can download my proposed solution from here.

     

    I did the following:

    1) create a new calendar table by ID.

    Date by ID = GENERATEALL(CALENDARAUTO(), VALUES('Days by ID'[ID]))

    2) Add to the calendar table a new column that checks if the date is included in the main table

    Included = 
    var currentID = [ID]
    var currentDate = [Date]
    RETURN
    COUNTX(FILTER('Days by ID','Days by ID'[ID]=currentID && 'Days by ID'[DateFrom]<=currentDate && 'Days by ID'[DateTo]>=currentDate),[Value] )

    3) Add one measure to count the missing days

    Count of missing days = COUNT([Date])-COUNTX('Date by ID',[Included])

    4) Add one measure that returns 'missing' if there are missing days

    Check if missing = IF([Count of missing days]<>0, "Missing")

     

    Below is a screenshot:

     

    I hope this helps you. Do not hesitate if you have further questions

     

    LC

    Interested in Power BI and DAX tutorials? Check out my blog at www.finance-bi.com