cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
dokat
Post Prodigy
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
bcdobbs
Super User
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

LinkedIn | Twitter | Blog

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

View solution in original post

2 REPLIES 2
bcdobbs
Super User
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

LinkedIn | Twitter | Blog

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

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

 

Thanks

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors