Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

CALCULATE with SUM and FILTER

Hi everyone,

 

I have been trying the whole day to sum a column applying some filter on it. I got the first formula that I'm using the value of a slicer in a condition with a lookup to get the correct date format, and then another simple condition.

 

CALCULATE( 

SUM( GRC_F_KPI[KPI_VALUE] );
FILTER( GRC_F_KPI; GRC_F_KPI[DATE] = LOOKUPVALUE(GRC_F_KPI[DATE]; Test_Period[MONTHOFYEAR]; ALLSELECTED(Test_Period[MONTHOFYEAR])) && GRC_F_KPI[COD_KPI] = "CB-11")
)

 

To this value I would like to deduct the month before value. In order to get that I'm using this formula but it does't work.

 

CALCULATE( 

SUM( GRC_F_KPI[KPI_VALUE] );
FILTER( GRC_F_KPI; GRC_F_KPI[DATE] = EDATE ( LOOKUPVALUE( GRC_F_KPI[DATE]; Test_Period[MONTHOFYEAR]; ALLSELECTED(Test_Period[MONTHOFYEAR] ) ); -1) && GRC_F_KPI[COD_KPI] = "CB-11")
)

 

Thanks for your help.

2 REPLIES 2
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous

 

It seems you may try to use PREVIOUSMONTH Function. If it is not your case, please share some data sample and expected output. You can upload it to OneDrive or Dropbox and post the link here. 

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Super User
Super User

See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.