Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
joharabbas
New Member

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 2
joharabbas
New Member

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.
FreemanZ
Super User
Super User

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
    )

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.