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.
I got a matrix displaying the name of clients in the rows and the sales per month on the column.
I got a Year slicer for this matrix. I have a measure that gets the December sales of the previous year.
What I intend to do is add another column to display the sales for the month divided by the said December sales for the previous year. My problem is that the December sales is cannot be used monthly columns.
I hope my question makes sense. Thank you in advance.
Solved! Go to Solution.
Hi @giorajo
Try this code
Total Sales = CALCULATE(SUM(Sales[Sales]))
Sales Rel to Prev Dec =
VAR __PrevYear =
YEAR ( MAX ( DateTab[Date] ) ) - 1
VAR __PrevDec =
CALCULATE (
[Total Sales],
DATESBETWEEN (
DateTab[Date],
DATE ( __PrevYear, 12, 1 ),
DATE ( __PrevYear, 12, 31 )
)
)
RETURN
CALCULATE ( DIVIDE ( [Total Sales], __PrevDec ), 0 )
2019 (vs Dec 2018)
2020 (vs Dec 2019)
Hope this helps
David
Hi,
Share the link from where i can download your PBI file.
Hi @giorajo
you have to create a measure for each month and user it in the table chart
Jan_Dec = [Jan]/[Calc_December]
Feb_Dec = [Feb]/[Calc_December]
...
Jan_Dec = [Dec]/[Calc_December]
Hope it resolves your issue? Did I answer your question? Mark my post as a solution! Appreciate your Kudos, Press the thumbs up button!! Linkedin Profile |
Hi @giorajo
Try this code
Total Sales = CALCULATE(SUM(Sales[Sales]))
Sales Rel to Prev Dec =
VAR __PrevYear =
YEAR ( MAX ( DateTab[Date] ) ) - 1
VAR __PrevDec =
CALCULATE (
[Total Sales],
DATESBETWEEN (
DateTab[Date],
DATE ( __PrevYear, 12, 1 ),
DATE ( __PrevYear, 12, 31 )
)
)
RETURN
CALCULATE ( DIVIDE ( [Total Sales], __PrevDec ), 0 )
2019 (vs Dec 2018)
2020 (vs Dec 2019)
Hope this helps
David
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.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |