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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Inventuory filling dates

I've a table Propre for stock like the following picture

jaweher89_0-1653634812932.png

Please find here the report .pbix https://1drv.ms/u/s!Amd7BXzYs7AVlXPjuP0CfblYyc5K?e=aZ1mab

For example, for epc =4767426B3030340000000007, I need to check the maximum date existing in the table propore. The maximum date = 15/05/2022

Then, when the user selects date range between 01/02/2022 till 03/07/2022,

So I need to display nb=1 for all dates less than the maximum dates, so for the example for all dates between 01/02/2022 till 15/05/2022, I should dispaly 1. And for all dates between 16/05/2022 till 03/07/2022, I should dispaly 0.

I create a new table Inventaire but it returns wrong resulats

Inventaire = 
GENERATE (
    filter(Propre, Propre[Statut]="PROPRE"),
    GENERATESERIES (
        CALCULATE ( DISTINCT ( Propre[Date] ) ),
        VAR Current_ =
            CALCULATE ( DISTINCT ( Propre[Date] ) )
        VAR Next_ =
            CALCULATE (
                MIN ( Propre[Date] ),
                Propre[Date] > Current_,
               ALL ( Propre[Nb] )
            )
        RETURN
            IF ( NOT ISBLANK ( Next_ ), Next_ - 1, Current_ )
    )
)

 

jaweher89_1-1653635170401.png

How to correct it to get the expected results?

 

 

1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

Hi @Anonymous ,

 

1. Sorry I could not get your pbix file successfully:

Eyelyn9_0-1653975304006.png

So I built a simply data sample for test:

Eyelyn9_4-1653976225349.png

 

2. Since you want to dynamically set the Nb value based on Date selections, you need to create a Date table for slicer firstly and then create Nb measure not column.

Dates for slicer = CALENDAR(MIN('Propre'[Date]),MAX('Propre'[Date]))

 

3. I have a question about the maximum date—— In my data sample,  the max Date for A is 2022/5/15 , for C is 2022/6/4, so the the maximum date is 2022/6/4 ? Or each EPCs has its own maximum date?

 

Please provide me with more details about your table and your expected output or share me with your pbix file after removing sensitive data.

 

 

Best Regards,
Eyelyn Qin
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

2 REPLIES 2
v-eqin-msft
Community Support
Community Support

Hi @Anonymous ,

 

1. Sorry I could not get your pbix file successfully:

Eyelyn9_0-1653975304006.png

So I built a simply data sample for test:

Eyelyn9_4-1653976225349.png

 

2. Since you want to dynamically set the Nb value based on Date selections, you need to create a Date table for slicer firstly and then create Nb measure not column.

Dates for slicer = CALENDAR(MIN('Propre'[Date]),MAX('Propre'[Date]))

 

3. I have a question about the maximum date—— In my data sample,  the max Date for A is 2022/5/15 , for C is 2022/6/4, so the the maximum date is 2022/6/4 ? Or each EPCs has its own maximum date?

 

Please provide me with more details about your table and your expected output or share me with your pbix file after removing sensitive data.

 

 

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

Anonymous
Not applicable

Any help please

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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