Forum Discussion

Young_G_Han's avatar
Young_G_Han
Icon for Helper III rankHelper III
4 years ago
Solved

Filling the empty production date

Dear Masters!

 

I need your help. I am spending more than two days for one formula.

 

Table

 

Date             Product    Process            Q'ty

2022.5.1       Shoes       Right Bottom     1

2022.5.3       Shoes       Left Bottom        1

2022.5.6       Shoes       Right Top            1

2022.5.9       Shoes       Completed         1

 

 

I want to make a graph with the quantity of work in processes.

 

So I need to make a table like this.

 

Date              Product        Q'ty

2022.5.1        Shoes             1

2022.5.2        Shoes             1

2022.5.3        Shoes             1

2022.5.4        Shoes             1

2022.5.5        Shoes             1

2022.5.6        Shoes             1

2022.5.7        Shoes             1

2022.5.8        Shoes             1

2022.5.9        Shoes             1

2022.5.10

2022.5.11

2022.5.12

 

This means I don't want any quantity after the appointed date like the completed day.

I have tried to use the lastnonblankvalue, but it is showing the quantity until the max date in the Date[Date].

If I use the date in the process table, the calculation takes a super long time.

 

Is there any wonder master can help me?

  • Anonymous's avatar
    Anonymous
    4 years ago

    HI Young_G_Han,

    You can summarize raw table records and use crossjoin with a calendar date to create the expanding table, then you can use raw table field values to filter the result table records which are not included in the ranges.

    CROSSJOIN function (DAX) - DAX | Microsoft Docs

    NewTable =
    SELECTCOLUMNS (
        FILTER (
            CROSSJOIN (
                SUMMARIZE (
                    Table,
                    [Product],
                    "Start", MIN ( Table[Date] ),
                    "End", MAX ( Table[Date] )
                ),
                Calendar
            ),
            [Date] >= [Start]
                && [Date] <= [End]
        ),
        "Date", [Date],
        "Product", [Product],
        "Qty", 1
    )

    Regards,

    Xiaoxin Sheng

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    HI Young_G_Han,

    You can summarize raw table records and use crossjoin with a calendar date to create the expanding table, then you can use raw table field values to filter the result table records which are not included in the ranges.

    CROSSJOIN function (DAX) - DAX | Microsoft Docs

    NewTable =
    SELECTCOLUMNS (
        FILTER (
            CROSSJOIN (
                SUMMARIZE (
                    Table,
                    [Product],
                    "Start", MIN ( Table[Date] ),
                    "End", MAX ( Table[Date] )
                ),
                Calendar
            ),
            [Date] >= [Start]
                && [Date] <= [End]
        ),
        "Date", [Date],
        "Product", [Product],
        "Qty", 1
    )

    Regards,

    Xiaoxin Sheng