Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
How can we make dynamically(Automatically) years can be selected in below formula ?
Measure = CALCULATE ( SUM ( table[AMOUNT_USD] ), FILTER ( table, table[SCENARIO] = "ACTUAL" && table[CURRENT_YEAR] = "2022" ) ) - CALCULATE ( SUM ( table[AMOUNT_USD] ), FILTER ( table, table[SCENARIO] = "ACTUAL" && table[CURRENT_YEAR] = "2021" ) )
please help me.
Hi @anjanikumar ,
Not sure I understand your needs correctly. If you want to calculate the difference in amount between current year and the previous year, then try the time intelligence functions, like this:
Measure =
CALCULATE ( SUM ( 'Table'[AMOUNT_USD] ), DATESYTD ( Dates[Date] ) )
- CALCULATE ( SUM ( 'Table'[AMOUNT_USD] ), PREVIOUSYEAR ( Dates[Date] ) )
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi ,
Thank you for your support in Advance !!
after that i have created below measure but manually need to change this year values -2 and -3 in this measure , i want change automatically that years (like subtraction -2 and -3).Please help me.
VPY = CALCULATE(BUF_DATAMART_V[AMOUNT_USD_ACTUAL],BUF_DATAMART_V[CURRENT_YEAR]=YEAR(TODAY())-2)-CALCULATE(BUF_DATAMART_V[AMOUNT_USD_ACTUAL],BUF_DATAMART_V[CURRENT_YEAR]=YEAR(TODAY())-3)
Hi @anjanikumar ,
Maybe you can try the What-if parameter, so you can dynamically change the year based on the parameter value.
VPY =
CALCULATE (
BUF_DATAMART_V[AMOUNT_USD_ACTUAL],
FILTER ( BUF_DATAMART_V, BUF_DATAMART_V[CURRENT_YEAR] = [Parameter Value] )
)
- CALCULATE (
BUF_DATAMART_V[AMOUNT_USD_ACTUAL],
FILTER ( BUF_DATAMART_V, BUF_DATAMART_V[CURRENT_YEAR] = [Parameter Value] - 1 )
)
Best Regards,
Winniz
For the First, Calculate function use This: -
VPY = CALCULATE(BUF_DATAMART_V[AMOUNT_USD_ACTUAL],BUF_DATAMART_V[CURRENT_YEAR]=YEAR(TODAY())-2)-CALCULATE(BUF_DATAMART_V[AMOUNT_USD_ACTUAL],BUF_DATAMART_V[CURRENT_YEAR]=YEAR(TODAY())-3)
I dont want manually change the years like -2 and like -3, how to dynamically update ?
User | Count |
---|---|
23 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
12 | |
11 | |
7 | |
6 |