Forum Discussion
KilianM
5 years agoFrequent Visitor
Dynamic price change between two Date slicers
Hello everyone ! 🙂 I'm working on a specific report where we want to compare price variation between selection from two date slicers. 🤑 The datamodel is the following : I have my Calendar ...
- 5 years agoIf someone find a better solution don't hesitate to challenge it ! 🙂
Price Change =VAR E = CALCULATETABLE(SELECTCOLUMNS('PRICE',"Reference",'PRICE'[Reference],"Seller",'PRICE'[Seller],"Brand",'PRICE'[Brand]),NOT(ISBLANK('PRICE'[Price])))VAR F = ADDCOLUMNS(E,"ID",[Reference]&[Seller]&[Brand])VAR E2 = CALCULATETABLE(SELECTCOLUMNS('PRICE',"Reference2",'PRICE'[Reference],"Seller2",'PRICE'[Seller],"Brand2",'PRICE'[Brand]),ALL('CALENDAR'[WeekYear]),USERELATIONSHIP(COMPARE_DATE[WeekYear],'PRICE'[WeekYear]),NOT(ISBLANK('PRICE'[Price])))VAR F2 = ADDCOLUMNS(E2,"ID",[Reference2]&[Seller2]&[Brand2])VAR F3 = NATURALINNERJOIN(F,F2)VAR F4 = SELECTCOLUMNS(F3,"ID",[ID])RETURNCALCULATE('PRICE'[Price Change],'PRICE'[ID] IN F4)
PRICE CHANGE =CALCULATE(DIVIDE([Actual Price]-[Last Price],[Last Price])))
amitchandak
Super User
5 years agoKilianM , refer to my blog or video on how to deal with two slicers
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601
or
KilianM
5 years agoFrequent Visitor
Hello amitchandak,
Thank you for your answer.
My problem is how to compare only the references with prices in the two contexts.
Do you know how to deal with this problematic ?
Thank you,
Best regards,
KM