Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

CROSSFILTER HELP NEEDED

Hi!
I'm traying to retrieving the last date from item ledger entry with this DAX measure.

Data Ultima Vendita =
VAR MD = MAX('Inventory Transactions'[D_Date_SID])

RETURN
CALCULATE(
    FORMAT(
        DATE(
            LEFT(MD, 4),            
            MID(MD, 5, 2),        
            RIGHT(MD, 2)            
        ),
        "yyyy/mm/dd"
    ),
    'Inventory Transaction Type'[Inventory Transaction Type Code] = 0,
    CROSSFILTER(
        'Inventory Transaction Type'[D_Enum_InventoryTransactionType_SID],
        'Inventory Transactions'[D_Enum_InventoryTransactionType_SID],
        BOTH
    )
)


The relation in the model (and why I'm using the CROSSFILTER)

 

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Anonymous ,

    I create two tables as you mentioned and make a relationship between them.

    Then I think you can use this DAX code.

    Measure = 
    VAR MD = MAX('Inventory Transactions'[D_Date_SID])
    RETURN
    CALCULATE(
        FORMAT(
            DATE(
                LEFT(MD, 4),            
                MID(MD, 5, 2),        
                RIGHT(MD, 2)            
            ),
            "yyyy/mm/dd"
        ),
        'Inventory Transaction Type'[Inventory Transaction Type Code] = 0,
        CROSSFILTER(
            'Inventory Transaction Type'[D_Enum_InventoryTransactionType_SID],
            'Inventory Transactions'[D_Enum_InventoryTransactionType_SID],
            BOTH
        )
    )

     

     

     

    Best Regards

    Yilong Zhou

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

2 Replies

  • hi Anonymous ,

     

    try like:

     

    Data Ultima Vendita =

    CALCULATE(

       VAR MD = MAX('Inventory Transactions'[D_Date_SID])

        RETURN

        FORMAT(

            DATE(

                LEFT(MD, 4),            

                MID(MD, 5, 2),        

                RIGHT(MD, 2)            

            ),

            "yyyy/mm/dd"

        ),

        'Inventory Transaction Type'[Inventory Transaction Type Code] = 0,

        CROSSFILTER(

            'Inventory Transaction Type'[D_Enum_InventoryTransactionType_SID],

            'Inventory Transactions'[D_Enum_InventoryTransactionType_SID],

            BOTH

        )

    )

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    I create two tables as you mentioned and make a relationship between them.

    Then I think you can use this DAX code.

    Measure = 
    VAR MD = MAX('Inventory Transactions'[D_Date_SID])
    RETURN
    CALCULATE(
        FORMAT(
            DATE(
                LEFT(MD, 4),            
                MID(MD, 5, 2),        
                RIGHT(MD, 2)            
            ),
            "yyyy/mm/dd"
        ),
        'Inventory Transaction Type'[Inventory Transaction Type Code] = 0,
        CROSSFILTER(
            'Inventory Transaction Type'[D_Enum_InventoryTransactionType_SID],
            'Inventory Transactions'[D_Enum_InventoryTransactionType_SID],
            BOTH
        )
    )

     

     

     

    Best Regards

    Yilong Zhou

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