Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi Experts,
I need to calculate the last year same period sales in a calculated measure.
Here, the 1 period = 4 weeks and hence there are 13 periods in an year.
Here is the table where Period format and Sales are given. Column 3(Required Measure) needs to be calculate:
| Period | Sales | Required Measure |
| 2021P01 | 100 | |
| 2021P02 | 200 | |
| 2021P03 | 300 | |
| 2021P04 | 400 | |
| 2021P05 | 500 | |
| 2022P01 | 600 | 100 |
| 2022P02 | 700 | 200 |
| 2022P03 | 800 | 300 |
| 2022P04 | 900 | 400 |
| 2022P05 | 1000 | 500 |
Thanks in advance !
Solved! Go to Solution.
Hi,
1- create Dim Date with using the below script :
3- In the main table, create Measure for calculated the last year sales amount :
Hi,
In your Date dim, add the below column :
Hi @MahyarTF ,
Created calculated as you suggested and mapped to the main table but didn't work. The values were only returned for the last period and that too were quite weird values.
Hi,
1- create Dim Date with using the below script :
3- In the main table, create Measure for calculated the last year sales amount :
@atult if you can have year column seperately,
then you can use this dax to get py sales.
Accept the solution if it works for you.
Hi @Anonymous ,
It didn't work for me. Are you creating a calculated column or measure for this?
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 53 | |
| 35 | |
| 31 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 75 | |
| 72 | |
| 39 | |
| 35 | |
| 23 |