Forum Discussion

fionabee's avatar
fionabee
Icon for Helper I rankHelper I
1 year ago
Solved

Slicer / Date Issue

I am adding data to a line graph to show how many of a certain complaint type has come in over 12 months.  I have a filter on the visual to filter by the last 12 calendar months of receipt date an...
  • freginier's avatar
    1 year ago

    Hey there!

     

    Here are a few solutions for you:

    1. Since your x-axis is Receipt Date (Month, Year), make sure your dataset has a continuous date table. Power BI needs a proper date table to maintain continuity. Create a Date Table (if you don't have one):

    DateTable = ADDCOLUMNS(
    CALENDAR(DATE(2023,1,1), DATE(2025,12,31)),
    "Year", YEAR([Date]),
    "Month", FORMAT([Date], "MMM YYYY")
    )

    Go to Modeling → Mark as Date Table → Select Date.
    Use This Date Table in Your X-Axis: Instead of Receipt Date from your complaint dataset, use DateTable[Month].

     

    Another reason why months disappear is that Power BI does not plot blank values. You can modify your measure to return 0 when no data is available. Try this formula: Complaint_Count =
    VAR SelectedComplaints = SELECTEDVALUE(Complaints[ComplaintType])
    RETURN
    IF(
    NOT(ISBLANK(SelectedComplaints)),
    COUNT(Complaints[ReferenceNumber]),
    0
    )

    This ensures that even when no complaints exist for a given month, Power BI plots 0 instead of removing the month.

     

    Hope this helps!

    Cheerio,

    Z 😁😁