Reply
avatar user
Anonymous
Not applicable
Partially syndicated - Outbound

stock calculation based on the next day

I've a table stock, when the product exists in my stock for a date, so it'll exist in the table as a new row

 

dateproduct
02/02/2022sundae
05/02/2022sundae

 

When the user select for example date filter from 01/02 till 07/02, I'd like to show 

dateproductstock
01/02/2022sundae1
02/02/2022sundae1
03/02/2022sundae0
04/02/2022sundae1
05/02/2022sundae1
06/02/2022sundae0
07/02/2022sundae0


For example, for 04/02, I need to look for whether it exists(next day) on 05/02 and as we see that it exists, we display 1 for 04/02. 
For example, for 06/02, I need to look for whether it exists(next day) on 07/02 and as we see that it does not exist, we display 0 for 06/02. 

For example, for 01/02, I need to look for whether it exists(next day) on 02/02 and as we see that it exists, we display 1 for 01/02. 

 

Any idea please?

 

 

1 ACCEPTED SOLUTION
avatar user
Anonymous
Not applicable

Syndicated - Outbound

Hi @Anonymous ,

Please refer to my pbix filw to see if it helps you.

Create a column first in the first table.

edate_ = 'Table'[date]-1

Then create a measure.

Measure =
VAR _maxdate =
    MAX ( 'Table'[date] ) - 1
RETURN
    IF (
        MAX ( 'Table (2)'[date] )
            IN VALUES ( 'Table'[date] )
                || MAX ( 'Table (2)'[date] ) IN VALUES ( 'Table'[edate_] ),
        1,
        0
    )

vpollymsft_0-1653894879237.png

 

 Best Regards
Community Support Team _ Polly

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

View solution in original post

3 REPLIES 3
avatar user
Anonymous
Not applicable

Syndicated - Outbound

Hi @Anonymous ,

Please refer to my pbix filw to see if it helps you.

Create a column first in the first table.

edate_ = 'Table'[date]-1

Then create a measure.

Measure =
VAR _maxdate =
    MAX ( 'Table'[date] ) - 1
RETURN
    IF (
        MAX ( 'Table (2)'[date] )
            IN VALUES ( 'Table'[date] )
                || MAX ( 'Table (2)'[date] ) IN VALUES ( 'Table'[edate_] ),
        1,
        0
    )

vpollymsft_0-1653894879237.png

 

 Best Regards
Community Support Team _ Polly

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

tamerj1
Super User
Super User

Syndicated - Outbound

Hi @Anonymous 
What about 05/02?

avatar user
Anonymous
Not applicable

Syndicated - Outbound

@tamerj1  for 05/02, I 'll check if the product exists in the table stock for this date 05/02, it exists, so I need to display 1.

 

Please let me know if you need more details, thank you very much

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)