Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Cant seem to figure this out
I have a simple sales table
Date of sale / Product name / Sales
I need to keep track of sales for new products for 3 months. So if a product first began selling on January 1st than I need to track it until April 1st.
How can I do this?
Thanks for your help!
Solved! Go to Solution.
Hi @Credo,
Please refer to below DAX to new calculated columns.
first sale time = CALCULATE ( MIN ( table5[Date of sale] ), ALLEXCEPT ( table5, table5[Product name] ) ) 3 months later = DATEADD ( table5[first sale time].[Date], 3, MONTH ) Sum sales = CALCULATE ( SUM ( table5[Sales] ), FILTER ( ALLEXCEPT ( table5, table5[Product name] ), table5[Date of sale] >= table5[first sale time] && table5[Date of sale] < table5[3 months later] ) )
Best regards,
Yuliana Gu
Hi @Credo,
Please refer to below DAX to new calculated columns.
first sale time = CALCULATE ( MIN ( table5[Date of sale] ), ALLEXCEPT ( table5, table5[Product name] ) ) 3 months later = DATEADD ( table5[first sale time].[Date], 3, MONTH ) Sum sales = CALCULATE ( SUM ( table5[Sales] ), FILTER ( ALLEXCEPT ( table5, table5[Product name] ), table5[Date of sale] >= table5[first sale time] && table5[Date of sale] < table5[3 months later] ) )
Best regards,
Yuliana Gu
User | Count |
---|---|
84 | |
79 | |
71 | |
48 | |
42 |
User | Count |
---|---|
111 | |
54 | |
50 | |
40 | |
40 |