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
khisla
Helper I
Helper I

Cumulative sum with exclusions

Hello BI Community

I am looking to compare Daily Target to Actual Daily Net Sales.

I have a query with the Daily Targets and a seperate query with the Daily Sales Transactions.

I need to add up the Sales Transaction by store & by date and add the column to Daily Target query.

Additionally, I need to only include sales transactions with - (1) Transaction Type = Sales and (2) Entry Status = Blank

 

Query 1

StoreDateTarget
IL20401/04/2025                         28,000
IL20402/04/2025                         25,000
IL20404/04/2025                         33,000
IL20713/04/2025                         38,000
IL20714/04/2025                         35,000
IL20715/04/2025

                                   -  

 

 

Query 2

 

Receipt No.Transaction TypeEntry StatusStore No.Date Net Amount (excl. VAT) 
000IL20401000219880Float Entry IL20401/04/2025                                                -  
000IL20401000219881Sales IL20401/04/2025-                                           339
000IL20401000219882Sales IL20401/04/2025-                                           169
000IL20401000219883Sales IL20401/04/2025-                                             85
000IL20401000219884Sales IL20401/04/2025                                            220
000IL20401000219885SalesVoidedIL20401/04/2025-                                             70
000IL20401000219926Open Drawer IL20401/04/2025-                                             50
000IL20401000220022Tender Decl. IL20401/04/2025-                                           200
000IL20401000220023Float Entry IL20402/04/2025-                                             70
000IL20401000220024Sales IL20402/04/2025-                                           156
000IL20401000220025Sales IL20402/04/2025-                                           152
000IL20401000220026Sales IL20402/04/2025-                                             25
000IL20401000220147Tender Decl. IL20402/04/2025-                                             50
000IL20401000220283Float Entry IL20404/04/2025                                                -  
000IL20401000220310SalesVoidedIL20404/04/2025-                                           200
000IL20401000220311Sales IL20404/04/2025-                                             85
000IL20401000220319Open Drawer IL20404/04/2025                                                -  
000IL20401000220318Sales IL20404/04/2025-                                           601
000IL20401000220323Sales IL20404/04/2025-                                           212
000IL20401000220375Sales IL20404/04/2025-                                           227
000IL20401000220376SalesVoidedIL20404/04/2025                                            500
000IL20401000220377Sales IL20404/04/2025-                                             83
000IL20401000220378Sales IL20404/04/2025-                                           136
000IL20401000220379Sales IL20404/04/2025-                                           127
000IL20401000220380Sales IL20404/04/2025-                                           212
000IL20401000220381Sales IL20404/04/2025-                                           159
000IL20401000220382Tender Decl. IL20404/04/2025                                        1,000
000IL20701000067072Float Entry IL20714/04/2025-                                           350
000IL20701000067073Float Entry IL20714/04/2025                                            700
000IL20701000067076Sales IL20714/04/2025-                                           415
000IL20701000067077Sales IL20714/04/2025-                                       1,050
000IL20701000067080Sales IL20714/04/2025-                                           771
000IL20701000067081Sales IL20714/04/2025                                            305
000IL20701000067082SalesVoidedIL20714/04/2025-                                       1,500
000IL20703000133373Tender Decl. IL20715/04/2025-                                           254
000IL20703000133374Sales IL20715/04/2025-                                       1,465
000IL20703000133375Sales IL20715/04/2025-                                           745
000IL20703000133376Open Drawer IL20715/04/2025-                                           500
000IL20703000133377Float Entry IL20715/04/2025-                                           288
000IL20703000133378SalesVoidedIL20715/04/2025-                                       2,000
000IL20703000133379Sales IL20715/04/2025-                                           136
000IL20703000133380Sales IL20715/04/2025                                            763

 

The figures in BOLD should be included in the Actual Net Sales figure

 

Expected Result

 

StoreDateTargetActual Net Sales
IL20401/04/2025                         28,000-                                  373
IL20402/04/2025                         25,000-                                  334
IL20404/04/2025                         33,000-                              1,840
IL20713/04/2025                         38,000                                        -  
IL20714/04/2025                         35,000-                              1,931
IL20715/04/2025                                   -  -                              1,584
1 ACCEPTED SOLUTION
MasonMA
Impactful Individual
Impactful Individual

@khisla 

Hi, i'd suggest leveraging Power Query UI to get the work down with a few simple clicks;

1. Filter your Query2 according to your message 'I need to only include sales transactions with - (1) Transaction Type = Sales and (2) Entry Status = Blank'

MasonMA_3-1752431466061.png

 

2. On your Query2, Group by 'Store' and 'Date' to Sum the 'Net Amount'.

MasonMA_0-1752431834318.png

 

3. Merge the transformed Query1 and Query2 to a new Query based on 'Store' and 'Date'.

MasonMA_1-1752432156701.png

 

4. Expand your 'Actual Net Sales' to get your final table for Reporting.

MasonMA_2-1752432193929.png

 

No code option. Hope it helps! 

View solution in original post

5 REPLIES 5
khisla
Helper I
Helper I

@MasonMA was a solution

 

v-tejrama
Community Support
Community Support

Hi  @khisla 

Thanks for reaching out to the Microsoft fabric community forum.

 

 

Has your issue been resolved?If the response provided by @FBergamaschi and  @MasonMA  addressed your query, could you please confirm? It helps us ensure that the solutions provided are effective and beneficial for everyone. 

 

Best Regards,
Tejaswi.
Community Support

 

MasonMA
Impactful Individual
Impactful Individual

@khisla 

Hi, i'd suggest leveraging Power Query UI to get the work down with a few simple clicks;

1. Filter your Query2 according to your message 'I need to only include sales transactions with - (1) Transaction Type = Sales and (2) Entry Status = Blank'

MasonMA_3-1752431466061.png

 

2. On your Query2, Group by 'Store' and 'Date' to Sum the 'Net Amount'.

MasonMA_0-1752431834318.png

 

3. Merge the transformed Query1 and Query2 to a new Query based on 'Store' and 'Date'.

MasonMA_1-1752432156701.png

 

4. Expand your 'Actual Net Sales' to get your final table for Reporting.

MasonMA_2-1752432193929.png

 

No code option. Hope it helps! 

FBergamaschi
Post Prodigy
Post Prodigy

My result

 

image4.png

 

I created a key to connect the two tables with a relationship

 

key = Actual[Date] & Actual[Store No.]
 
key = Target[Date] & Target[Store]

 

Then created the below measure

 

Actual =
CALCULATE(
    SUM ( Actual[ Net Amount (excl. VAT) ] ),
    Actual[Entry Status] = "",
    Actual[Transaction Type] = "Sales"
)
 
File here
 

If this helped, please consider giving kudos and mark as a solution

@mein replies or I'll lose your thread

consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

@khisla 

 

Is mine or @MasonMA answer a solution?

 

Please let us know

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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.