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
Ttaylor9870
Helper III
Helper III

Sales before and after if stand is TRUE

Hey All,

 

I've been stuck on the following problem. I'd like to know the amount before and after a customer receives a stand.

 

Logic would be sales after STAND is true based on the Posting DATE

 

See my example table below...

 

CustomerAmountPosting DateItem NoProduct NameStand

A105/01/2023TD01AAATRUE
A206/01/2023REDBBBFALSE
A307/01/2023BLUECCCFALSE
B105/01/2023TD01AAATRUE
B204/01/2023REDBBBFALSE
B307/01/2023BLUECCCFALSE
C104/01/2023TD01AAATRUE
C203/01/2023REDBBBFALSE
C302/01/2023BLUECCCFALSE

 

Many Thanks,

 

Taylor

3 REPLIES 3
Anonymous
Not applicable

Hi @Ttaylor9870 ,

Below is my table:

vxiandatmsft_0-1704350661316.png

The following DAX might work for you:

Column = 
VAR A =
CALCULATE(
    MAX('Tabelle1'[Date]),
    FILTER(
        ALL(Tabelle1),
        'Tabelle1'[stand] = True && 'Tabelle1'[Customer_Amount] = EARLIER(Tabelle1[Customer_Amount])
    )
)
RETURN
   IF(Tabelle1[stand] = True , 
   'Tabelle1'[Date],
   A
    )

The final output is shown in the following figure:

vxiandatmsft_1-1704350735884.png

Best Regards,

Xianda Tang

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

Ttaylor9870
Helper III
Helper III

Hey @Anonymous,

 

See the below expected results...

 

CustomerAmountPosting DateItem NoProduct NameStandStand Posting Date  (Expected Output)
A105/01/2023TD01AAATRUE05/01/2023
A206/01/2023REDBBBFALSE05/01/2023
A307/01/2023BLUECCCFALSE05/01/2023
B105/01/2023TD01AAATRUE05/01/2023
B204/01/2023REDBBBFALSE05/01/2023
B307/01/2023BLUECCCFALSE05/01/2023
C104/01/2023TD01AAATRUE04/01/2023
C203/01/2023REDBBBFALSE04/01/2023
C302/01/2023BLUECCCFALSE04/01/2023

 

The logic would be as follows, DAX or Power Query to....

 

Go through the table to find customer -> Then find the products the customer has bought -> For that specific product if they bought a stand (Stand = TRUE) for that product return the MAX posting Date.

 

So there could be a couple products per customer. The above is just a short example.😊

 

Many Thanks,

 

Taylor

Anonymous
Not applicable

Hi @Ttaylor9870 ,

Can you send us the expected result graph, thank you

Best Regards

Xianda Tang

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

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.