This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Hi everyone,
Hopefully someone can help me out with my issue here, I have a condition for a measure. If sales type equal to 1 then i do want to do nothing but if its not equal to 1 i want to value minus.
Calculated Gross Amount =
VAR SelectedSalesType = SELECTEDVALUE(dwh_invoice_header[sales_type])
VAR GrossAmount = SUM(dwh_invoice_header[gross_amount])
RETURN
IF(SelectedSalesType = 1, GrossAmount, -GrossAmount)
This code works for rows but sub total is wrong.
How can i fix it?
Solved! Go to Solution.
Hi @samil01
You can try the following measure
Total =
IF (
[Calculated Gross Amount] > 0,
SUMX (
FILTER ( dwh_invoice_header, [Calculated Gross Amount] > 0 ),
[Calculated Gross Amount]
),
[Calculated Gross Amount]
)
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @samil01
You can try the following measure
Total =
IF (
[Calculated Gross Amount] > 0,
SUMX (
FILTER ( dwh_invoice_header, [Calculated Gross Amount] > 0 ),
[Calculated Gross Amount]
),
[Calculated Gross Amount]
)
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for the answer,
I try to add SUMX and a write an other DAX something like this,
Total = SUMX(dwh_invoice_header,[Calculated Gross Amount])
and it kind of works but the problem now is subtracts negative values twice
what i am doing wrong?
Hi @samil01
I will do the following:
CalculatedGrossSales= SUM('Table'[gross_amount])
And now:
Total = SUMX('Table', IF('Table'[Sales_type] = 1, -[CalculatedGrossSales], [CalculatedGrossSales]))
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 37 | |
| 29 | |
| 29 | |
| 21 | |
| 18 |
| User | Count |
|---|---|
| 69 | |
| 39 | |
| 33 | |
| 24 | |
| 23 |