Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi all.,
I want to create a measure in which i can calculate the total of one month with total of same month in last year. like this i want to calculate for all 2019 months with 2018 months.
Solved! Go to Solution.
Hi @Anonymous
If i understand you correctly, you could create a calendar table
calendar = CALENDARAUTO()
Create a relationship between the two tables
Create measures in your data table
this year = SUM('Table'[value]) last year = CALCULATE([this year],SAMEPERIODLASTYEAR('calendar'[Date])) divide = IF([last year]<>BLANK(),([this year]-[last year])/[this year])
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous
Create a calendar table, then create relationship between it and your table
calendar = ADDCOLUMNS(CALENDARAUTO(),"year",YEAR([Date]),"month",MONTH([Date]))
Create measures
2018 = CALCULATE(SUM('Table'[value]),FILTER(ALL('calendar'),'calendar'[year]=2018)) 2019= CALCULATE(SUM('Table'[value]),FILTER(ALL('calendar'),'calendar'[year]=2019)) ration = [2019]/[2018]
If 2018 is the total sales from previous year till 2018 (eg, 2011~2018), change the "=" to "<="
2018 = CALCULATE(SUM('Table'[value]),FILTER(ALL('calendar'),'calendar'[year]<=2018))
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous
If i understand you correctly, you could create a calendar table
calendar = CALENDARAUTO()
Create a relationship between the two tables
Create measures in your data table
this year = SUM('Table'[value]) last year = CALCULATE([this year],SAMEPERIODLASTYEAR('calendar'[Date])) divide = IF([last year]<>BLANK(),([this year]-[last year])/[this year])
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Actually i want to calculate the sum of all months sale in 2018 and then i want to divide those particular sums with the sales of 2019. according to the point which you mentioned helped me in getting the idea how to do it but i am still not getting the right figures my example is like this maybe it can help you understand the problem better:
CATEGORY(NEW AND OLD)
SALES 2018 (NEW+OLD) SALES(ONLY NEW)2019 RATIO
150 130 130/150(86.66)
180 120 120/180(66.66)
i am here just trying to calculate the ratio.
Thanks for the help.
Hi @Anonymous
Create a calendar table, then create relationship between it and your table
calendar = ADDCOLUMNS(CALENDARAUTO(),"year",YEAR([Date]),"month",MONTH([Date]))
Create measures
2018 = CALCULATE(SUM('Table'[value]),FILTER(ALL('calendar'),'calendar'[year]=2018)) 2019= CALCULATE(SUM('Table'[value]),FILTER(ALL('calendar'),'calendar'[year]=2019)) ration = [2019]/[2018]
If 2018 is the total sales from previous year till 2018 (eg, 2011~2018), change the "=" to "<="
2018 = CALCULATE(SUM('Table'[value]),FILTER(ALL('calendar'),'calendar'[year]<=2018))
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.