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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
AndreaCBS
Helper III
Helper III

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)

AndreaCBS_0-1730972158331.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @AndreaCBS ,

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

vyilongmsft_0-1731035086813.png

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
    )
)

vyilongmsft_1-1731035198742.png

 

 

 

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.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @AndreaCBS ,

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

vyilongmsft_0-1731035086813.png

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
    )
)

vyilongmsft_1-1731035198742.png

 

 

 

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.

FreemanZ
Super User
Super User

hi @AndreaCBS ,

 

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

    )

)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.