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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Filtering

I have a model with 3 columns Buy/Sell (which a text column), Amount (Integer) and Date (Date). I need to be able to subtract sells from buys over a variety of time periods. I can't work out if this should be done as a new calculated column or measure.  Dax sample.JPG

1 ACCEPTED SOLUTION

Hi,

 

Try this

 

=CALCULATE(SUM(Data[Amount]),Data[Buy/Sell]="Buy")

 

and

 

=CALCULATE(SUM(Data[Amount]),Data[Buy/Sell]="Sell")

 

Hope this helps.

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

5 REPLIES 5
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

Please post your expected result based on the sample table, so that we can share the workaround which is close to your requirement.

Best Regards,
Angelia

Anonymous
Not applicable

I am trying to filter all buys with dates into a measure and all sells into a measure so that I can subtract sells from buys over anytime period.

Hi,

 

Try this

 

=CALCULATE(SUM(Data[Amount]),Data[Buy/Sell]="Buy")

 

and

 

=CALCULATE(SUM(Data[Amount]),Data[Buy/Sell]="Sell")

 

Hope this helps.

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi @Anonymous,

 

What result are you expecting?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
vcastello
Resolver III
Resolver III

Hi @Anonymous

 

A measure should work.

 

I assume all the sell records have a minus sign so ...

Measure1 = SUM(TableName[Amount])

 

should work

 

If you create a visual and place the date in one axis or column or whatever visual you choose and in the values of that visual you place Measure1 should work with no problems.

Hope that helps

 

Vicente

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors