Match Historical Prices Help

%3CLINGO-SUB%20id%3D%22lingo-sub-3403222%22%20slang%3D%22es-ES%22%3EMatch%20Historical%20Prices%20Help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3403222%22%20slang%3D%22es-ES%22%3E%3CP%3E%3CSPAN%20class%3D%22%22%3EHello%20everyone%2C%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3EI%20would%20like%20to%20find%20a%20way%20to%20match%20historical%20prices%20according%20to%20sale%20date%20ranges%3CBR%20%2F%3EThese%20are%20my%20tables.%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3EThank%20you%20all.%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Sin%20t%C3%ADtulo.png%22%20style%3D%22width%3A%20888px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F373438i258DB6F290551DC5%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Sin%20t%C3%ADtulo.png%22%20alt%3D%22Untitled.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3403222%22%20slang%3D%22es-ES%22%3E%3CLINGO-LABEL%3EBI%20%26amp%3B%20Data%20Analysis%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3404234%22%20slang%3D%22en-US%22%3ERe%3A%20Match%20Historical%20Prices%20Help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3404234%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1395242%22%20target%3D%22_blank%22%3E%40maxfabian16%3C%2FA%3E%26nbsp%3BI%20created%20a%20similar%20model%20in%20PowerPivot%20and%20came%20up%20with%20a%20DAX%20measure%20%22LastPrice%22%20that%20does%20what%20you%20need.%20Please%20see%20attached.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202022-05-20%20at%2009.28.39.png%22%20style%3D%22width%3A%20317px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F373538iA78149D6DE236D0A%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202022-05-20%20at%2009.28.39.png%22%20alt%3D%22Screenshot%202022-05-20%20at%2009.28.39.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBy%20the%20way%2C%20your%20screenshot%20looks%20like%20you%20are%20working%20in%20PowerBI.%20If%20so%2C%20you%20could%20simplify%20the%20measure%20by%20using%20SELECTEDVALUE%20rather%20than%20IF%20and%20HASONEVALUE%2C%20although%20I'm%20a%20little%20bit%20out%20of%20my%20comfort%20zone%20here.%20There%20may%20be%20better%20ways%20to%20do%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

Hello everyone,

I would like to find a way to match historical prices according to sale date ranges
These are my tables.

Thank you all.

Sin título.png

1 Reply

@maxfabian16 I created a similar model in PowerPivot and came up with a DAX measure "LastPrice" that does what you need. Please see attached.

Screenshot 2022-05-20 at 09.28.39.png

 

By the way, your screenshot looks like you are working in PowerBI. If so, you could simplify the measure by using SELECTEDVALUE rather than IF and HASONEVALUE, although I'm a little bit out of my comfort zone here. There may be better ways to do it.