Forum Discussion
pavloshlapa
1 year agoFrequent Visitor
Summarize by group on condition
Dear Experts,
I have a following Virtual Table:
Purchase Revenue = SUM(All_Orders[netvalue])Purchase Revenue Last Year =
CALCULATE(
[Purchase Revenue], SAMEPERIODLASTYEAR('Date Table'[Date]))Revenue Difference =
[Purchase Revenue] - [Purchase Revenue Last Year]
I would like to create a virtual table of vendors with sum of difference, if difference is < 0, something like that:
| Vendor | Purchase Revenue |
| A&P Zeefdruck | -174,15 |
| ABB AG | -6894 |
| Total | -7068,15 |
What would in your opinion be the best way to do that?
Sincerely,
Pavlo
Hello, pavloshlapa
you can do something like this:
diffBelow0 = CALCULATE( [diff], FILTER(VALUES('Table'[id]), [diff] < 0) )
3 Replies
- vojtechsima
Super User
Hello, pavloshlapa
you can do something like this:
diffBelow0 = CALCULATE( [diff], FILTER(VALUES('Table'[id]), [diff] < 0) ) - Bibiano_Geraldo
Super User
Hi, create a measure with the following DAX code:
Measure = IF( [Revenue Difference] < 0, [Revenue Difference], BLANK() )And then add a Matrix with [Nameofvendor] in rows fields and this created measure in values field.
I hope this help you.
Thank you
- pavloshlapaFrequent Visitor
vojtechsima works like a charm, thanks