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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
WalletMasster
Regular Visitor

Issue with measures

Hi i am new to Power BI 
Total Sales (Latest Year) = CALCULATE( SUM(Sale[SalesAmount]), FILTER('Sale', 'Sale'[Date].[Year] = [Latest Year]) ) i have this measure which is suppose to calculate sales for latest year(2022 in this case) but its calculating for all years.I tried  instead of latest year i put 2022 and it displayed the sales for 2022.But i check the value of latest year and it returns 2022 so why doesnt it work. 
this my latest year measure 

Latest Year = MAX(Sale[Date].[Year])
1 ACCEPTED SOLUTION
Manoj_Nair
Solution Supplier
Solution Supplier

@WalletMasster- Please check this out, let me know if this works. If this fix your problem, please tick this a solution and a thumps up.

 

Total Sales (Latest Year) = 
VAR CurrentYear = MAX('Sale'[Date].[Year])
RETURN
CALCULATE(
    SUM('Sale'[SalesAmount]), 
    FILTER('Sale', YEAR('Sale'[Date]) = CurrentYear)
)

 

I've hypothetically established this DAX measure, but without much clarity regarding your datasets. If this doesn't serve your needs, I recommend you share a sample dataset. This will give me a more comprehensive understanding of your data structure, enabling me to devise a more suitable solution.

View solution in original post

4 REPLIES 4
Manoj_Nair
Solution Supplier
Solution Supplier

@WalletMasster- Please check this out, let me know if this works. If this fix your problem, please tick this a solution and a thumps up.

 

Total Sales (Latest Year) = 
VAR CurrentYear = MAX('Sale'[Date].[Year])
RETURN
CALCULATE(
    SUM('Sale'[SalesAmount]), 
    FILTER('Sale', YEAR('Sale'[Date]) = CurrentYear)
)

 

I've hypothetically established this DAX measure, but without much clarity regarding your datasets. If this doesn't serve your needs, I recommend you share a sample dataset. This will give me a more comprehensive understanding of your data structure, enabling me to devise a more suitable solution.

Thanks it works, can i ask you another question its about filtering

rsureshkumar98
Regular Visitor

Hi Wallet Masster, 

 

You can use below DAX

 

Total Sales = CALCULATE(SUM(Sales([SalesAmount]),FILTER(YEAR(TODAY())-1)

 

Let me know if this works

This works too thanks

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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