Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
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.
Solved! Go to Solution.
Hi,
Try this
=CALCULATE(SUM(Data[Amount]),Data[Buy/Sell]="Buy")
and
=CALCULATE(SUM(Data[Amount]),Data[Buy/Sell]="Sell")
Hope this helps.
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
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.
Hi @Anonymous,
What result are you expecting?
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
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 45 | |
| 38 | |
| 34 | |
| 21 | |
| 17 |
| User | Count |
|---|---|
| 65 | |
| 63 | |
| 31 | |
| 26 | |
| 25 |