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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
bestevez
Helper I
Helper I

DAX This Year against LY SCD

Hi,

 

I need to know how much I bought de PrdID 1 in 2018 where PrdID 1 in 2018 es 2 like the column PrdIDLY show.

 

ProductIdDAteKeyPurchaseDateAmountIndexPrdIDPrdIDLY
12019040505/04/20193112
12019040505/04/20192112
12019040707/04/20192112
12019040707/04/20191112
22018040505/04/20185223
22018040505/04/20185223

 

Regards

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi @bestevez 

If I understand you correct try a measure

Measure = CALCULATE(
    SUM('Table'[Amount]);
    FILTER(ALL('Table');'Table'[PrdID]=SELECTEDVALUE('Table'[PrdIDLY]) && YEAR('Table'[PurchaseDate])=YEAR(SELECTEDVALUE('Table'[PurchaseDate]))-1)
)

 

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

1 REPLY 1
az38
Community Champion
Community Champion

Hi @bestevez 

If I understand you correct try a measure

Measure = CALCULATE(
    SUM('Table'[Amount]);
    FILTER(ALL('Table');'Table'[PrdID]=SELECTEDVALUE('Table'[PrdIDLY]) && YEAR('Table'[PurchaseDate])=YEAR(SELECTEDVALUE('Table'[PurchaseDate]))-1)
)

 

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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