Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hi Guys,
Please can someone help with a lag function.
Calculation needed :
Working Platform Conversion =
Buying Platform(This Year BP- LY BP )/Last year WP
Required output in BI
Single column with the value WPC
Data Structure
Table 1
pillar BU name region od name market value date
XXX xx x x xx x BP JAN2021
YYY yy x x xx x BP FEB 2021
ZZZ zz x x xx x BP MAR 2021
AAA AA x x xx x BP APR 2021
BBB BB x x xx x BP MAY 2021
CCC CC x x xx x BP JUNE 2021
XXX xx x x xx x BP JULY2021
YYY yy x x xx x BP AUG 2021
ZZZ zz x x xx x BP SEP 2021
AAA AA x x xx x BP OCT 2021
BBB BB x x xx x BP NOV 2021
CCC CC x x xx x BP DEC 2021
XXX xx x x xx x WP JAN2021
YYY yy x x xx x WP FEB 2021
ZZZ zz x x xx x WP MAR 2021
AAA AA x x xx x WP APR 2021
BBB BB x x xx x WP MAY 2021
CCC CC x x xx x WP JUNE 2021
XXX xx x x xx x WP JULY2021
YYY yy x x xx x WP AUG 2021
ZZZ zz x x xx x WP SEP 2021
AAA AA x x xx x WP OCT 2021
BBB BB x x xx x WP NOV 2021
CCC CC x x xx x WP DEC 2021
XXX xx x x xx x BP JAN2022
YYY yy x x xx x BP FEB 2022
ZZZ zz x x xx x BP MAR 2022
AAA AA x x xx x BP APR 2022
BBB BB x x xx x BP MAY 2022
CCC CC x x xx x BP JUNE 2022
XXX xx x x xx x BP JULY2022
YYY yy x x xx x BP AUG 2022
ZZZ zz x x xx x BP SEP 2022
AAA AA x x xx x BP OCT 2022
BBB BB x x xx x BP NOV 2022
CCC CC x x xx x BP DEC 2022
XXX xx x x xx x WP JAN2022
YYY yy x x xx x WP FEB 2022
ZZZ zz x x xx x WP MAR 2022
AAA AA x x xx x WP APR 2022
BBB BB x x xx x WP MAY 2022
CCC CC x x xx x WP JUNE 2022
XXX xx x x xx x WP JULY2022
YYY yy x x xx x WP AUG 2022
ZZZ zz x x xx x WP SEP 2022
AAA AA x x xx x WP OCT 2022
BBB BB x x xx x WP NOV 2022
CCC CC x x xx x WP DEC 2022
Hi,
I would recommend doing this using measures but here is a calculated column example:
Example data:
Calculated column:
Measure example for this year BP:
Proud to be a Super User!
Hi @ValtteriN,
Thank you for the above, would it possible for you to drop the powr bi file that you did the example in here
Thanks
Zaynah
Hi,
Unfortunately I am not able to provide the pbix file.
Proud to be a Super User!
Hi @Zaynah16 ,
Could you please share some sample data (exclude sensitive data) and your expected result with calculation logic and special examples in order to make troubleshooting and provide you a suitable solution? It is better if you can provide a simplified pbix file. Thank you.
In addition, it seems that you are trying to get the difference between the current year and the previous year and then do the rest of the calculations based on your description. If that is the case, you can refer to the following blog to implement it.
How to compare Last year and Current Year sales in Power BI?
CREATING A POWER BI CHART COMPARING EACH YEAR VS PREVIOUS YEAR
Best Regards
@Zaynah16 , You need time intelligence with date table and additional filter
Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA
example
YTD Sales BP= CALCULATE(Countrows(Table),DATESYTD('Date'[Date],"12/31"), filter(Table, Table[Market] = "BP" ))
Last YTD Sales BP = CALCULATE(Countrows(Table),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"), filter(Table, Table[Market] = "BP" ))
YTD Sales WP= CALCULATE(Countrows(Table),DATESYTD('Date'[Date],"12/31"), filter(Table, Table[Market] = "WP" ))
Last YTD Sales WP = CALCULATE(Countrows(Table),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"), filter(Table, Table[Market] = "WP" ))
Check out the April 2026 Power BI update to learn about new features.
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.
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 22 | |
| 10 | |
| 10 | |
| 7 | |
| 5 |