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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
chema
New Member

dax formula

HI everyone,

I have cumulative data that includes common columns for month, year, and region, covering investment data from 2021 to 2024. Since this data is cumulative, I need to extract the value for the last month of each year for each region. Despite trying several DAX formulas, I have not been able to achieve the desired result. Could you suggest a solution?

2 ACCEPTED SOLUTIONS
KNP
Super User
Super User

As long as you have a date table in your model you could use either CLOSINGBALANCEMONTH or CLOSINGBALANCEYEAR depending on what you're looking for.

 

 

KNP_0-1731263675804.png

 

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
xOIEmaj

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
image
fabric-SUbadge
Proud to be a Super User!

View solution in original post

Anonymous
Not applicable

Hi @chema ,

Thanks for KNP's reply!
And @chema , I created the sample data myself based on your description:

vjunyantmsft_0-1731395486465.png

Then you can use this DAX to create a measure:

LastMonthValue = 
CALCULATE(
    MAX('Investments'[Value]),
    FILTER(
        'Investments',
        'Investments'[Month_number] = CALCULATE(
            MAX('Investments'[Month_number]),
            ALLEXCEPT('Investments', 'Investments'[Year], 'Investments'[Region])
        )
    )
)

And put the measure into the table visual, the final output is as below:

vjunyantmsft_1-1731395573501.png


Best Regards,
Dino Tao
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

3 REPLIES 3
Anonymous
Not applicable

Hi @chema ,

Thanks for KNP's reply!
And @chema , I created the sample data myself based on your description:

vjunyantmsft_0-1731395486465.png

Then you can use this DAX to create a measure:

LastMonthValue = 
CALCULATE(
    MAX('Investments'[Value]),
    FILTER(
        'Investments',
        'Investments'[Month_number] = CALCULATE(
            MAX('Investments'[Month_number]),
            ALLEXCEPT('Investments', 'Investments'[Year], 'Investments'[Region])
        )
    )
)

And put the measure into the table visual, the final output is as below:

vjunyantmsft_1-1731395573501.png


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

KNP
Super User
Super User

As long as you have a date table in your model you could use either CLOSINGBALANCEMONTH or CLOSINGBALANCEYEAR depending on what you're looking for.

 

 

KNP_0-1731263675804.png

 

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
xOIEmaj

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
image
fabric-SUbadge
Proud to be a Super User!
chema
New Member

chema_0-1731262942759.png

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.