Forum Discussion

xhurit's avatar
xhurit
Frequent Visitor
5 years ago
Solved

Turn off dimension rows

Hi,   I have a report which should be showing only fact data for stores that were open in selected date period on Date slicer.   Model contains Fact table and Store dimension, where each store ha...
  • v-alq-msft's avatar
    5 years ago

    Hi, xhurit 

     

    Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

    Store:

     

    Fact:

     

    Calendar(a calculated table):

    Calendar = CALENDARAUTO()

     

    Relationships:

     

    You may create meausres like below.

    Number of active store = 
    var tab =
    CALCULATETABLE(
        DISTINCT(Store[Store]),
        FILTER(
            ALL(Store),
            NOT(
                OR(
                    [Date_Open]>MAX('Calendar'[Date]),
                    [Date_Close]<MIN('Calendar'[Date])
                )
            )
        )
    )
    return
    COUNTROWS(
        tab
    )

     

    Visual Control = 
    var startdate = SELECTEDVALUE(Store[Date_Open])
    var enddate = SELECTEDVALUE(Store[Date_Close])
    var mindate = MIN('Calendar'[Date])
    var maxdate = MAX('Calendar'[Date])
    return
    IF(
        NOT(
            OR(
                enddate<mindate,
                startdate>maxdate
            )
        ),
        1,0
    )

     

    Avg = AVERAGE('Fact'[Sales])

     

    Then you may put 'Visual Control' in the visual level filter and use 'Date' column from 'Calendar' table to filter the result.

     

    Best Regards

    Allan

     

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