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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
admin11
Memorable Member
Memorable Member

How to increase the value automatically monthly increase by 1 digit ?

Hi All

 

I have below expression working fine :-

Show Last 24 Month = IF ('Date'[Date] >= EDATE(TODAY(),-25), 1, 0)
 
But next month i need to change 25 to 26
 
May i know it there a way to automatic change by itself ?
 
Reasons :- So that i can show each sales staff their sales achieve for monthly in last X month they much achievment sales Y amount.
 
Paul 
 
1 ACCEPTED SOLUTION

@v-xiaotang 

Thank you very much . I will try it out soon

View solution in original post

3 REPLIES 3
v-xiaotang
Community Support
Community Support

Hi @admin11 

You can create a table, column Month in the table is related to specific number, then switch the specific number according to column Month.

v-xiaotang_0-1622013006926.png

Create the column:

Show Last 24 Month =
VAR _month =
    MONTH ( TODAY () )
VAR _num =
    CALCULATE (
        SELECTEDVALUE ( 'Table'[Value] ),
        FILTER ( 'Table', MONTH ( 'Table'[Month] ) = _month )
    )
RETURN
    IF ( 'Date'[Date] >= EDATE ( TODAY (), _num ), 1, 0 )

result:

v-xiaotang_1-1622013006934.png

See sample file attached bellow.

 

By the way, I dont understand why you named the DAX column as Show Last 24 Month since you want the data of the past 25,26,27 months, is there anything wrong?

 

Best Regards,

Community Support Team _ Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

@v-xiaotang 

Thank you very much . I will try it out soon

amitchandak
Super User
Super User

@admin11 , I think you are starting from fix date of 1 April 2019

 

Show Last 24 Month = IF ('Date'[Date] >= date(2019,04,01) , 1, 0)

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.