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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Jay2022
Helper IV
Helper IV

Count only store A and Bs opening per month

What i'm trying to work out is the numnber of store A and Bs (combined) opening for each month like so 

 

Nov 24 - 4

Dec 24 - 2

 and so on 

 

not counting opening dates for stores C and D 

 

I have come across something like this below but i'm not sure how to filter to include only store A and B or if i'm even on the right track at all. 

 

Count of Stores Opening=

CALCULATE(

    COUNTA('Table'[Store Opening Date]),

    FILTER(

        ALLSELECTED('Table’[Month Number]),

        ISONORAFTER('Table'[Month Number], MAX('Table'[Month Number]), DESC)

    )

)

 

Any help greatly apprciated 

2 ACCEPTED SOLUTIONS
123abc
Community Champion
Community Champion

It looks like you’re on the right track with your DAX formula, but you’ll need to add a condition to filter for only stores A and B. Here’s how you can modify your formula to count the openings of only stores A and B:

Count of Stores Opening = 
CALCULATE(
    COUNTA('Table'[Store Opening Date]),
    FILTER(
        ALLSELECTED('Table'),
        'Table'[Store Type] IN {"A", "B"} &&
        ISONORAFTER('Table'[Month Number], MAX('Table'[Month Number]), DESC)
    )
)

In this modified formula:

  • The FILTER function now includes a condition to check if the Store Type is either “A” or “B”.
  • This ensures that only the opening dates for stores A and B are counted.

You can adjust the Store Type field name if it differs in your dataset. This should give you the count of store openings for A and B combined, per month.

If you have any more questions or need further assistance, feel free to ask!

View solution in original post

Kedar_Pande
Super User
Super User

@Jay2022 

Count of Stores Opening = 
CALCULATE(
COUNTA('Table'[Store Opening Date]),
FILTER(
'Table',
'Table'[Store Type] IN {"A", "B"} &&
'Table'[Store Opening Date] <= MAX('Table'[Store Opening Date])
)
)

💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

View solution in original post

5 REPLIES 5
Kedar_Pande
Super User
Super User

@Jay2022 

Count of Stores Opening = 
CALCULATE(
COUNTA('Table'[Store Opening Date]),
FILTER(
'Table',
'Table'[Store Type] IN {"A", "B"} &&
'Table'[Store Opening Date] <= MAX('Table'[Store Opening Date])
)
)

💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

Fantastic thanks for your help, how would i build another measure creating a running total of the stores opening currently I have a column of dates (month/year) and (thanks to your help a column of stores openeing Jan 4, Feb 6 etc i would like anoyther column which shows a runnning total so Jan 4, feb 10 etc 

123abc
Community Champion
Community Champion

It looks like you’re on the right track with your DAX formula, but you’ll need to add a condition to filter for only stores A and B. Here’s how you can modify your formula to count the openings of only stores A and B:

Count of Stores Opening = 
CALCULATE(
    COUNTA('Table'[Store Opening Date]),
    FILTER(
        ALLSELECTED('Table'),
        'Table'[Store Type] IN {"A", "B"} &&
        ISONORAFTER('Table'[Month Number], MAX('Table'[Month Number]), DESC)
    )
)

In this modified formula:

  • The FILTER function now includes a condition to check if the Store Type is either “A” or “B”.
  • This ensures that only the opening dates for stores A and B are counted.

You can adjust the Store Type field name if it differs in your dataset. This should give you the count of store openings for A and B combined, per month.

If you have any more questions or need further assistance, feel free to ask!

Thank you

123abc
Community Champion
Community Champion

You are always wellcome.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.