Forum Discussion

joharabbas's avatar
joharabbas
New Member
2 years ago

Need urgent help

Range_Selling_Count =
VAR SelectedDateRange =
    DATESBETWEEN(
        'Calendar'[Date],
        MIN('Calendar'[Date]),
        MAX('Calendar'[Date])
    )
RETURN
CALCULATE(
    DISTINCTCOUNT('Data'[Store Code]),
    FILTER(
        ALL('Data'[Store Code]),
        CALCULATE(
            DISTINCTCOUNT('Data'[SKU NAME NEW]),
            'Data'[SKU NAME NEW] IN {"ED 250 ML", "Sugar Free", "4 Pack"},
            'Calendar'[Date] IN SelectedDateRange
        ) >= 2
    )
) using this measure for the selected month by I need another measure for the same period last month and I have tried so much but cant find a solution please guide me

2 Replies

  • Hi joharabbas ,

     

    try like:

     

    Range_Selling_Count =
    VAR SelectedDateRange =
        DATESBETWEEN(
            'Calendar'[Date],
            EDATE(MIN('Calendar'[Date]), -1),
            EDATE(MAX('Calendar'[Date]), -1)
        )
    RETURN
    CALCULATE(
        DISTINCTCOUNT('Data'[Store Code]),
        FILTER(
            ALL('Data'[Store Code]),
            CALCULATE(
                DISTINCTCOUNT('Data'[SKU NAME NEW]),
                'Data'[SKU NAME NEW] IN {"ED 250 ML""Sugar Free""4 Pack"},
                'Calendar'[Date] IN SelectedDateRange
            ) >= 2
        )
  • Hi FreemanZ 

    Thanks for replying!

     

    RS SPLM =
    VAR SelectedDateRange =
        DATESBETWEEN(
            'Calendar'[Date],
            EDATE(MIN('Calendar'[Date]), -1),
            EDATE(MAX('Calendar'[Date]), -1)
        )
    RETURN
    CALCULATE(
        DISTINCTCOUNT('Data'[Store Code]),
        FILTER(
            ALL('Data'[Store Code]),
            CALCULATE(
                DISTINCTCOUNT('Data'[SKU NAME NEW]),
                'Data'[SKU NAME NEW] IN {"ED 250 ML", "Sugar Free", "4 Pack"},
                'Calendar'[Date] IN SelectedDateRange
            ) >= 2
        )
    ) its working but not giving the correct results actually Im switching between months by a month filter.