Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
anjanikumar
Helper III
Helper III

Dynamically how to write this Measure !!

Measure !!

 

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)

 

This meaure is working but manually need to change the prior years(like -2, -3 .. etc )

Every time I dont want to change the years manually like -2 and -3, i want update dynamically that numbers( am subtracting here by using that numbers). please help me asap.

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @anjanikumar ;

You could create a what-if table ,then create a measure.

1.create a what-if table

Parameter = GENERATESERIES(0, 10, 1)

vyalanwumsft_0-1645432040947.png

2.create a measure .

VPY = 
CALCULATE (
    [MOUNT_USD_ACTUAL1],
   FILTER('Table', 'Table'[CURRENT_YEAR]
        = YEAR ( TODAY () ) - [Parameter Value]))-
CALCULATE (
    [MOUNT_USD_ACTUAL1],
   FILTER('Table', 'Table'[CURRENT_YEAR]
        = YEAR ( TODAY () ) - [Parameter Value]-1))

 The final output is shown below:

vyalanwumsft_1-1645432097538.png

vyalanwumsft_2-1645432108092.png

 


Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi, @anjanikumar ;

You could create a what-if table ,then create a measure.

1.create a what-if table

Parameter = GENERATESERIES(0, 10, 1)

vyalanwumsft_0-1645432040947.png

2.create a measure .

VPY = 
CALCULATE (
    [MOUNT_USD_ACTUAL1],
   FILTER('Table', 'Table'[CURRENT_YEAR]
        = YEAR ( TODAY () ) - [Parameter Value]))-
CALCULATE (
    [MOUNT_USD_ACTUAL1],
   FILTER('Table', 'Table'[CURRENT_YEAR]
        = YEAR ( TODAY () ) - [Parameter Value]-1))

 The final output is shown below:

vyalanwumsft_1-1645432097538.png

vyalanwumsft_2-1645432108092.png

 


Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Greg_Deckler
Community Champion
Community Champion

@anjanikumar Perhaps use a parameter in a slicer and use SELECTEDVALUE in your formula? Otherwise, not really enough to go on.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.