Reply
benjaminzaidner
Frequent Visitor

CALCULATETABLE( SUMMARIZE( aggregation by def

"Hey, I need some assistance, please. I have the following formula. I also have another dataset, which is a file of shipment allocations by trucks and customers. I want to implement a condition where if a customer doesn't have an order totaling $800 on a specific date, then that order will be added to the next order. In the next order, it will again check if it reaches $800, and this can take into account the data from the previous order if there was one. So, I created a pivot for the original dataset, and now I'm planning to filter the data by customer and date, so I can identify when the condition occurs. Essentially, I want to reduce the number of shipments, so it only happens if the order reaches the threshold of $800. However, it's important to note that if there's an order for less than $800, we wait for accumulation until such an order is formed.

 

I am currently conducting the check on a specific month in the year 2024

 

like this , 

 

 

benjaminzaidner_0-1712012195732.png

 



customerShipments =
CALCULATETABLE(
SUMMARIZE(
'TABLE1',
'TABLE1'[customer],
'TABLE1'[date],
"Qty", SUM('TABL1'[AMOUNT])
),
'TABL1'[Year] = 2024,
'TABL1'[Month] = 2,
''TABL1'[AMOUNT] > 0
)

 

 

3 REPLIES 3
benjaminzaidner
Frequent Visitor

 

 

Please, I have attached a link to the file, thanks for wanting to help.

 

 

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

 

 

 

 

HI @benjaminzaidner,

After I test and coding formula on sample file based on your conditions, I find this requirement is a recursive calculation which not able to be achieved in Dax expressions. 

You can simply to check if current value is large than the target, but it is hard to use Dax to find the dynamic cumulative start range. (this should base on previous calculations)

If you want to know more about recursion calculation, you can take a look at Greg’s blog:

Previous Value (“Recursion”) in DAX 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
v-shex-msft
Community Support
Community Support

Hi @benjaminzaidner ,

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)