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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.