cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Post Prodigy

## Sum based on two criteria

Hi,

I have a data table where i would like to data where two conditions meet.

The name of teh table is P&L

I'd would like to pull data where Cleandar Year= 2021  and P&L= Off Invoice Sales

I am trying to use below formula however it is returning blank value

CALCULATE(SUM('P&L'[Values]),FILTER('P&L', ('P&L'[P&L]= "Off Invoice Sales" & ('P&L' [Calendar Year]= 12/31/2021))))

Can some one help me with the formla?
1 ACCEPTED SOLUTION
Super User

Try:

CALCULATE(

SUM('P&L'[Values]),
'P&L'[P&L]= "Off Invoice Sales",

'P&L'[Calendar Year]= 2021

)

I've tidied the code and also made calendar year equal just 2021.

If your calendar year is a date column use DATE(2021, 12, 31) to ensure it's being parsed correctly.

Ben Dobbs

Did I answer your question? Mark my post as a solution! This will help others on the forum!
2 REPLIES 2
Super User

Try:

CALCULATE(

SUM('P&L'[Values]),
'P&L'[P&L]= "Off Invoice Sales",

'P&L'[Calendar Year]= 2021

)

I've tidied the code and also made calendar year equal just 2021.

If your calendar year is a date column use DATE(2021, 12, 31) to ensure it's being parsed correctly.

Ben Dobbs

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Post Prodigy

Yes it worked with DATE(2021, 12, 31).

Thanks

Announcements

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

#### Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors