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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
rahulvyas
Frequent Visitor

Compare Daily Sales Vs Limit

Hello, 

Does anyone know how to compare the daily sales of a store with a given limit? I am trying to find out if the total daily sales irrespective of Currency are exceeding their limits per store. The limit table keeps on changing based on demand. Trying to build something with time intelligence so we can compare how many times the store went over its limits per year, quarter, or any different type of analysis.

Sales Table    
PostDateBranchCurrencyBalanceLimt
2020-03-17Store 1GBP280713.49 $   200,000.00
2020-03-17Store 1USD11825.00 $   200,000.00
2020-03-17Store 1CAD5785.00 $   200,000.00
2020-03-18Store 1USD33424.00 $   300,000.00
2020-03-18Store 1CAD-11228.00 $   300,000.00
2020-03-19Store 1CAD0.00 $   300,000.00
2020-03-19Store 1EUR202.50 $   300,000.00
2020-03-19Store 1GBP74.00 $   300,000.00
2020-03-19Store 1USD200.78 $   300,000.00
2020-11-16Store 1CAD60.00 $   300,000.00
2020-11-16Store 1CAD164580.00 $   300,000.00
2020-11-16Store 1USD11825.00 $   300,000.00
2021-11-16Store 1CAD5785.00 $   200,000.00
2021-11-16Store 1CAD33753.00 $   200,000.00
2021-11-17Store 1CAD290.66 $   200,000.00
2021-11-17Store 1CAD2314.00 $   200,000.00
2022-03-10Store 1CAD200.10 $   220,000.00
2022-03-10Store 1CAD303.00 $   220,000.00
2022-03-11Store 1USD200.28 $   220,000.00
2022-03-11Store 1CAD56998.10 $   220,000.00
2022-03-12Store 1EUR60134.32 $   220,000.00

 

Limit Table  
Date Store Current Limit   Old Limit 
11/5/2018 $200,000.00 
3/18/2020 $300,000.00 $200,000.00
8/17/2021 $200,000.00 $300,000.00
3/7/2022 $220,000.00 $200,000.00
1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Hi @rahulvyas 

 

Try this measure to find the total number of days with overrun:

Over The Limit = 
VAR _A =
    SUMMARIZE (
        'Sales Table',
        'Sales Table'[PostDate],
        "Sale", SUM ( 'Sales Table'[Balance] )
    )
VAR _B =
    ADDCOLUMNS (
        _A,
        "Limit",
            CALCULATE (
                MAX ( 'Limit Table'[ Store Current Limit  ] ),
                FILTER (
                    ALL ( 'Limit Table' ),
                    'Limit Table'[Date]
                        = CALCULATE (
                            MAX ( 'Limit Table'[Date] ),
                            FILTER ( ALL ( 'Limit Table' ), 'Limit Table'[Date] <= EARLIER ( [PostDate] ) )
                        )
                )
            )
    )
VAR _C =
    ADDCOLUMNS ( _B, "Over", IF ( [Sale] > [Limit], 1, 0 ) )
RETURN
    SUMX ( _C, [Over] )

 

Download the sample file attached.

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

View solution in original post

2 REPLIES 2
Whitewater100
Solution Sage
Solution Sage

Hi:

Please find attached link comparing credit limit during period to balance. A new Limit table and Fact Table are in the model. I altered the format of the limit table so it can be used a bit easier down the road.

 

You can probably take it much further in terms of these changing dimensions by store and date, however I think this is what you are looking for for now. I hope so! Thanks

https://drive.google.com/file/d/1dziPjkIk2ub9vofzGUTu8krkl58aKZ7K/view?usp=sharing 

 

Whitewater100_0-1649121324605.png

 

VahidDM
Super User
Super User

Hi @rahulvyas 

 

Try this measure to find the total number of days with overrun:

Over The Limit = 
VAR _A =
    SUMMARIZE (
        'Sales Table',
        'Sales Table'[PostDate],
        "Sale", SUM ( 'Sales Table'[Balance] )
    )
VAR _B =
    ADDCOLUMNS (
        _A,
        "Limit",
            CALCULATE (
                MAX ( 'Limit Table'[ Store Current Limit  ] ),
                FILTER (
                    ALL ( 'Limit Table' ),
                    'Limit Table'[Date]
                        = CALCULATE (
                            MAX ( 'Limit Table'[Date] ),
                            FILTER ( ALL ( 'Limit Table' ), 'Limit Table'[Date] <= EARLIER ( [PostDate] ) )
                        )
                )
            )
    )
VAR _C =
    ADDCOLUMNS ( _B, "Over", IF ( [Sale] > [Limit], 1, 0 ) )
RETURN
    SUMX ( _C, [Over] )

 

Download the sample file attached.

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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