Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowTry your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now
I am trying to write a calculation that if the Year is 2023 and the months are March and April, don't include those numbers in the sum. If have the filter working for the month but need to include code to only exclude the month if it is a particular year (2023). Can you assist?
Here is the measure to exlude the 2 months. I just need to be able to only exclude these months IF it's 2023. I can't quite get it.
Solved! Go to Solution.
Hi @vwiles84 ,
Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:
Create a measure
Donation QTY Minus MarApril =
CALCULATE(
SUM('Table'[Value]),
FILTER(
'Table',
'Table'[Year] <> 2023 || ('Table'[Month]<> "April" && 'Table'[Month]<>"March")
)
)
Final output
Best regards,
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @vwiles84 ,
Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:
Create a measure
Donation QTY Minus MarApril =
CALCULATE(
SUM('Table'[Value]),
FILTER(
'Table',
'Table'[Year] <> 2023 || ('Table'[Month]<> "April" && 'Table'[Month]<>"March")
)
)
Final output
Best regards,
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi,
First of all store the year value on a vairable
Var ActivYear=selectedvalue(date(year)
var DonationQty=CALCULATE(SUM(RPT_ITM_D[F64]),RPT_ITM_D[F1034]=3)
var result= If(ActivYear=2023,
calculate(DonationQty,NOT ('Date Table'[Month Name] in {"April","March"}),
DonationQty)
Return
result
Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.
Check out the May 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 24 | |
| 22 | |
| 21 | |
| 20 | |
| 14 |
| User | Count |
|---|---|
| 59 | |
| 53 | |
| 41 | |
| 31 | |
| 31 |