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
Anonymous
Not applicable

Exclude current month values via calculated column

Hello, I am trying to exclude values with the date = the last nonblank date & with the value_type = 'actuals'. I make this distinction because I am graphing Forecast vs Actuals , & forecast values go out to end of 2021, and actuals are actualized months that appear in our db the next mid-month for the previous month. I'm having an issue graphing net gains where for the most current month with no actuals values populated yet, it is showing a complete negative net gain, so I'd like to exclude this month of data.

To get the last month with nonblank values (accurate): 

CALCULATE(LASTNONBLANKVALUE('Main'[date_column],MAX('Main'[date_column])),'Main'[value_type]="actuals")

But now to exclude the actuals values, this below does not work:

IF(AND('Main'[value_type]="actuals",'Main'[date_column] = CALCULATE(LASTNONBLANKVALUE('Main'[date_column],MAX('Main'[date_column])),'Main'[value_type]="actuals")

),"Delete","")

 

THank you in advance.

 

1 ACCEPTED SOLUTION
v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

You may create calculated column like DAX below.

 

Column1 =
VAR _MaxDate =
    CALCULATE (
        MAX ( Main[date] ),
        ALLEXCEPT ( Main, Main[product_name], Main[value_type] )
    )
RETURN
    IF ( Main[value_type] = "actuals" && Main[date] = _MaxDate, "Delete", BLANK () )

 

Best Regards,

Amy 

 

Community Support Team _ Amy

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

4 REPLIES 4
v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

You may create calculated column like DAX below.

 

Column1 =
VAR _MaxDate =
    CALCULATE (
        MAX ( Main[date] ),
        ALLEXCEPT ( Main, Main[product_name], Main[value_type] )
    )
RETURN
    IF ( Main[value_type] = "actuals" && Main[date] = _MaxDate, "Delete", BLANK () )

 

Best Regards,

Amy 

 

Community Support Team _ Amy

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

amitchandak
Super User
Super User

@Anonymous , Can you share sample data and sample output in table format?

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Yes, here is a screenshot to illustrate. For example today on 7/21, I'd like to exclude row 4 from appearing on a Net Gains visualization by filtering out "Delete" in the calculated column. But cannot get the formula correct.

sk824a_0-1595348710343.png

 

Anonymous
Not applicable

To add more information, when I use the second formula above for the calculated column, it incorrectly excludes all actuals values. When I'd like to just exclude only that month's values for actuals.

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.