Forum Discussion
angelikakolacz
Helper I
3 years agoSearch with multiple criteria
Hello,
I have a table with more than milion rows with data from different customers. I’m looking for a dax formule that gives me the following result (see column output):
| ACCOUNT NUMBER | INVOICE NUMBER | INVOICE AMOUNT | TYPE OF INVOICE | PERIODE | OUTPUT |
| 1111 | 1234 | € 19,00 | Inovice | 3-2020 | 1236 |
| 1111 | 1235 | € -19,00 | Credit | 7-2020 | 1238 |
| 1111 | 1236 | € -19,00 | Credit | 3-2020 | 1234 |
| 1111 | 1237 | € -19,00 | Credit | 8-2020 | 0 |
| 1111 | 1238 | € 19,00 | Inovice | 7-2020 | 1235 |
| 1111 | 1239 | € 19,00 | Inovice | 9-2020 | 0 |
| 1111 | 1240 | € 19,00 | Inovice | 6-2020 | 0 |
| 1111 | 1241 | € 19,00 | Inovice | 6-2020 | 0 |
| 1112 | 1242 | € 19,00 | Inovice | 7-2020 | 1244 |
| 1112 | 1243 | € 19,00 | Inovice | 8-2020 | 1245 |
| 1112 | 1244 | € -19,00 | Credit | 7-2020 | 1242 |
| 1112 | 1245 | € -19,00 | Credit | 8-2020 | 1243 |
I am looking for the same (but opposite) invoice for the same period per customer. If this invoice does not appear, result 0 is sufficient.
I hope someone can help me with this.
15 Replies
- Jihwan_Kim
Super User
Hi,
Based on what I see in the sample, I tried to write DAX formula like below in order to create a calculated column.
Please check the below picture and the attached pbix file.
Output CC = VAR _result = SUMMARIZE ( FILTER ( Data, Data[ACCOUNT NUMBER] = EARLIER ( Data[ACCOUNT NUMBER] ) && Data[PERIODE] = EARLIER ( Data[PERIODE] ) && Data[INVOICE AMOUNT] = -1 * EARLIER ( Data[INVOICE AMOUNT] ) ), Data[INVOICE NUMBER] ) RETURN _result + 0 - angelikakolacz
Helper I
Hi Jihwan_Kim ,
I get this as a result:
A customer may receive more than 1 invoice for a specific periode. Could it be this?
- Jihwan_Kim
Super User
Hi,
Please share your sample pbix file's link here, and then I can try to look into it.
- angelikakolacz
Helper I