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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Create measure filter

I need to create a measure that makes a calculation by there a filter I do, for example, calculate (sum (table [column]); table [column that will suffer the filter]) in my case would be the year filter

5 REPLIES 5
Sean
Community Champion
Community Champion

@Anonymous If you are going to use a Slicer or Filter - why add the filter in the Formula as well?

 

Can you explain better?

Anonymous
Not applicable

@Sean@Greg_Deckler

 

For the filter to determine a value for a single object, which will be using this measure,

for example: I have a graph and want their values to be displayed only when a filter is done year

 

some would like this: Sum ({$ <Year = {'<= $ (= Only (Year))'}, Month =>} Vl Rest processed)

Sean
Community Champion
Community Champion

I don't get this. But you can always hard code the filter like this for example

 

2015 Total = CALCULATE (SUM(Table[Column]), CalendarTable[Year]=2015)

 

If you want to do Year to Date = TOTALYTD(SUM(Table[Column]), CalendarTable[Date]) 

@Sean's method was one of the alternatives that I was alluding to. The equivalent in SUMX syntax is:

 

=SUMX(FILTER(Table, Table[Year]=2015),[ColumnToSum])

Here is an article on SUM vs. SUMX vs. CALCULATE

http://www.powerpivotpro.com/2014/10/sum-sumx-or-calculatechoices-choices/

 

The article isn't complete as it doesn't mention that you can also change the filter context with SUMX.



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...
Greg_Deckler
Super User
Super User

Couple different ways of doing that, but I would use SUMX

 

https://msdn.microsoft.com/en-us/library/ee634959.aspx

 



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
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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