Forum Discussion
Compare differnt time for differnt products in a single bar chart
Hi,
I have below information, please help.
Product A - Data from Feb,2014 to Aug,2018
Product B - Dat from Jan,2018 to Aug,2018
Problem - I want to campare month 1(Feb 2014)of Product A and month 1(Jan,2018) of product B on a single bar chart.
I want to campare month 6thof Product A and month 6th of product B on a single bar chart.
Can someone please help.
1 Reply
- v-piga-msft
Resident Rockstar
Hi pgarg,
1. For your first requirement, you could refer to the formula below.
measure1 = VAR mindate_each_product = CALCULATE ( MIN ( 'Table'[Date] ), ALLEXCEPT ( 'Table', 'Table'[Product] ) ) RETURN CALCULATE ( SUM ( 'Table'[Sales] ), FILTER ( 'Table', 'Table'[Date] = mindate_each_product ) )Here is the output.
2. For your second requirement, I'm not clear what the 6th month do you want to calculate? Do you want to calculate value of the 6th month for each year or the 6th month for all date?
The general logic is that you can calculate the value of the first 6 months and then subtract the value of the first 5 months is the value of the sixth month.
For reference, you could use DATEADD function.
If you need further, please feel free to ask.
Best Regards,
Cherry