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
dw2468
Frequent Visitor

Calculate Function with DATEADD and Filter not working

I have the code for current month, which works well for me. However if I check the DATEADD to -1, the current month row data doesn't show the previous month value in the table visual. Any idea why?

 

 

CurrM = CALCULATE(
    SUM('CADUSD'[Balance]),
    FILTER(
        'CADUSD', 'CADUSD'[Data Type] <> "Plan"
    ),
    DATEADD(
        Calendar[Date], 0, MONTH
    )
)


PrevM = CALCULATE(
    SUM('CADUSD'[Balance]),
    FILTER(
        'CADUSD', 'CADUSD'[Data Type] <> "Plan"
    ),
    DATEADD(
        Calendar[Date], -1, MONTH
    )
)

 

 

 

dw2468_0-1710333615143.png

 

5 REPLIES 5
ray_aramburo
Super User
Super User

See my example attached on how to set up the measures, you can adjust as needed:

ray_aramburo_0-1710346428250.png

 

ray_aramburo_1-1710346454362.png

I used a similar structure of yours but changed my totals just to serve as an example.





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





ray_aramburo
Super User
Super User

You are filtering your data for February so in the filter context there's nothing to be shown for January but it appears since you included a Previous Month value as well. For Current Month you should remove the DateAdd portion of the measure, it is not needed.





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





if I remove the months filter, the CurrM column now has more than 1 values. I should expect CurrM to only show only the february number when i have DATEADD, 0, MONTH (see image attached)

 

dw2468_0-1710340865838.png

 

dw2468
Frequent Visitor

not sure why i did the same in my model and it wouldn't work. the result is the same as per my original screenshot.

Why would you need the Data Type column filter on the measure but then add it to the visual?





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





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.