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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Yunus_Miah
Regular Visitor

DAX formula for determining the number of days during which a store has recorded no sales.

For my analysis, I require information on the number of days when the store did not record any sales or when its operations were closed.

2 REPLIES 2
Yunus_Miah
Regular Visitor

Thanks for the reply. Actually, I have a fact table containing day-wise, store-wise sales information. On a particular day, some stores might have sales information, while others might not sell anything.


DateStore IDSales
1/1/2023    1100000
1/1/2023    220000

1/1/2023

    3400000

 

But I have 4 stores, and I want a output like below:

 

Store IDNo of Days without Sales
1                                      0
2                                      0
3

0

4

1

 

v-nuoc-msft
Community Support
Community Support

Hi @Yunus_Miah

 

For your question, here is the method I provided:

 

Here's some dummy data

 

"Table"

vnuocmsft_0-1704854891268.png

 

Create a measure, calculate the number of days that the store didn't record any sales or close operations

vnuocmsft_1-1704855278306.png

 

Days With No Sales = 
    CALCULATE(
        COUNTROWS('Table'),
        NOT(
            'Table'[sales] > 0
            ),
        FILTER(
            ALL('Table'),
            'Table'[store] = MAX('Table'[store])
        )
    )

 

 

Here is the result

vnuocmsft_2-1704855334792.png

 

If you're still having problems, provide some dummy data and the desired outcome. It is best presented in the form of a table.

 

Regards,

Nono Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors