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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Jay2022
Helper III
Helper III

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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