Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
How do i calculate year to year diffrence if my data type is in a whole number and not in "date" datatype. I only have sales data for 2021 and 2022. There are no month and day data. Most of tutorial/solution that I watch use calendar(dim date). But in my case I used only years data only which is in whole number datatype.
Solved! Go to Solution.
Hi,
I am not sure how your datamodel looks like, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
I hope the below can provide some ideas on how to create a solution for your datamodel.
Sales: =
SUM( Sales[Sales] )
Sales diff ratio: =
VAR _currentyear =
MAX ( Sales[Year] )
VAR _salescurrentyear =
CALCULATE ( [Sales:], Sales[Year] = _currentyear )
VAR _salesprevyear =
CALCULATE ( [Sales:], Sales[Year] = _currentyear - 1 )
RETURN
DIVIDE ( _salescurrentyear - _salesprevyear, _salesprevyear )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi,
I am not sure how your datamodel looks like, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
I hope the below can provide some ideas on how to create a solution for your datamodel.
Sales: =
SUM( Sales[Sales] )
Sales diff ratio: =
VAR _currentyear =
MAX ( Sales[Year] )
VAR _salescurrentyear =
CALCULATE ( [Sales:], Sales[Year] = _currentyear )
VAR _salesprevyear =
CALCULATE ( [Sales:], Sales[Year] = _currentyear - 1 )
RETURN
DIVIDE ( _salescurrentyear - _salesprevyear, _salesprevyear )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi Kim, thank you so much for the answer. It's worked for data that only contain (2 years) 2022 and 2021. May I know what should I do for the 10 years data from 2011 until 2022 ? I need to find the differences of each year with the previous year. I try using your method but there is no changes in my data when I select one of the year within 10 years
Hi,
Please provide your sample pbix file's link, and the expected outcome of how the visualization looks like.
And then I can try to look into it to come up with a solution.
Thank you.
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
User | Count |
---|---|
141 | |
113 | |
104 | |
78 | |
64 |
User | Count |
---|---|
136 | |
125 | |
107 | |
70 | |
61 |