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
Hi Team,
I am trying to sum distinct values from amount_total column based on state and invoice_status columns. State should be "draft" and invoice_status should be "no"
Answer: 200000
Thanks for all your help
Solved! Go to Solution.
create a measure like
Sum of distinct values =
var distinctAmounts = CALCULATETABLE(VALUES('Table'[amount_total]),
TREATAS( { ( "draft", "no") }, 'Table'[state], 'Table'[invoice_status])
)
return SUMX(distinctAmount, [amount_total])
Hi John,
Really appreciate your help in solving my problem. What is TREATAS.
Your solution worked great.
Thanks again
TREATAS is a means of moving or creating filters. If you want to filter a number of columns by different values then you can create a table using {} table constructor and then use TREATAS to say this column of this table matches the first value, this column of that table matches the 2nd value etc.
Also handy if you want to move an existing filter from one table to another, e.g. TREATAS(VALUES('Table1'[id]), 'Table2'[id])
create a measure like
Sum of distinct values =
var distinctAmounts = CALCULATETABLE(VALUES('Table'[amount_total]),
TREATAS( { ( "draft", "no") }, 'Table'[state], 'Table'[invoice_status])
)
return SUMX(distinctAmount, [amount_total])
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 |
|---|---|
| 66 | |
| 65 | |
| 31 | |
| 26 | |
| 26 |