Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Slicer using DimDate do not ge filtered based on Fact

I have created DimDate with calculated colums. I have report with Stacked Column chart, Year slicer and WeekNum slicer.

 

I have now difficulties to use DimDate as slicer. I have data from only 2019 in fact table which have been connected to DimDate. DimDate covers 2019-2013 dates.

However my slicers for Year and WeekNum shows every single rows that exists in DimDate. How to configure slicer and relationship so that Slicer get only values that includes data in Fact.

 

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi , 

    Create your date dimesion with below DAX.

     

    DateTable =
    ADDCOLUMNS (
    CALENDARAUTO(),
    "Year", YEAR ( [Date] ),
    "QuarterOfYear", FORMAT ( [Date], "Q" ),
    "MonthOfYear", FORMAT ( [Date], "MM" ),
    "DateInt", FORMAT ( [Date], "YYYYMMDD" ),
    "MonthName", FORMAT ( [Date], "mmmm" ),
    "MonthInCalendar", FORMAT ( [Date], "mmm YYYY" ),
    "QuarterInCalendar", "Q" & FORMAT ( [Date], "Q" ) & " " & FORMAT ( [Date], "YYYY" ),
    "DayInWeek", WEEKDAY ( [Date] ),
    "DayOfWeekName", FORMAT ( [Date], "dddd" ),
    "DayOfWeekShort", FORMAT ( [Date], "ddd" ),
    "YearMonthShort", FORMAT ( [Date], "YYYY/mmm" ),
    "MonthNameShort", FORMAT ( [Date], "mmm" ))




    Best Regards,
    Mail2inba4


    If this post helps, then please consider Accept it as the solution to help the other members find easily

    • Anonymous's avatar
      Anonymous
      Not applicable

      Seems to work. Thanks.  How to add Week Number to the script? (1-52)

      • Tahreem24's avatar
        Tahreem24
        Super User
        =weeknum(Table[Datecolumn])

        Don't forget to hit Thumbs up and mark it as a solution if it helps you.
  • Change the relationship cardinality to one to many and cross filter direction to both.

    Please hit Thumbs up for support and accept this as a solution if it helps you.
    • Anonymous's avatar
      Anonymous
      Not applicable

      I tried "many to one" with "both" and "one to many" with "both". No positive effect to slicers.