The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi
Is it possible to have difference of sales between Years for current visual ?
Sales are from Fact table.
Years and Month from Date table.
Thanks,
Srikanth
Solved! Go to Solution.
create w measure as follow :
measure =
var current_year = max(dimdate[year])
var prev_year = current_year - 1
var current_year_calc = sum(tbl_name[col_name])
var prev_year_calc =
calculate (
sum(tbl_name[col_name]),
all(dimdate),
dimdate[year] = prev_year,
values(dimdate[month])
)
)
return
current_year_calc - prev_year_calc
let me know if it works for you .
If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution !✅
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠
you can just add a switch statement at the end,
switch(
true() ,
current_sales = 0 || prev_sales = 0 , 0 , [your calculation])
let me know if you need any other help .
@kanth123 Should be: Better Year Over Year Change - Microsoft Fabric Community
Thanks for video. helped in creating optimized measures.
create w measure as follow :
measure =
var current_year = max(dimdate[year])
var prev_year = current_year - 1
var current_year_calc = sum(tbl_name[col_name])
var prev_year_calc =
calculate (
sum(tbl_name[col_name]),
all(dimdate),
dimdate[year] = prev_year,
values(dimdate[month])
)
)
return
current_year_calc - prev_year_calc
let me know if it works for you .
If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution !✅
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠
This helps but not 100%, when there are no sales in Current or Prior year it should be 0.
you can just add a switch statement at the end,
switch(
true() ,
current_sales = 0 || prev_sales = 0 , 0 , [your calculation])
let me know if you need any other help .
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
102 | |
97 | |
80 | |
62 | |
57 |
User | Count |
---|---|
264 | |
120 | |
115 | |
83 | |
70 |