Hello,
I always solved problems with VBA. Recently, I had 4-day training in Power BI and I start solving more with it instead (easier on customer side).
I have two files that need to interact with each other. One is supposed to be gathering sum of sales value per customer. Second table is "raw data" with all sales listed. The problem is, that first table lists customers by ID that is divided accross several columns in sales data (second table). Maybe it's better to show on example data (attached).
First table: Client ID (first column) is different by type. The type of ID is listed in second column (sorry, I can't install plugin to post in BB code, so I attach it as images)
Second table: "Raw data" that has all sales of all customers. No column is unique, but client is identified by first 3 columns (number, company, group). Raw data is stored in separate file.
Relation between tables depends on "ClientType" in first table. It should sum values either by column A, or column B or column C in raw data (table2)... Don't know how to get around this obstacle.
I did solve counting with nested (many) IF and SUMIFS formula, but it's both very slow and complicated to refresh data on client side. It would be much easier, if I could just replace raw data file on server and make Power BI read from it and sum values accordingly.
A formula solution to example. Real, final formula for real data is much longer (more types, more conditions):
Any tips how to proceed with getting data in table 1 by setting relation to Table 2?
I always solved problems with VBA. Recently, I had 4-day training in Power BI and I start solving more with it instead (easier on customer side).
I have two files that need to interact with each other. One is supposed to be gathering sum of sales value per customer. Second table is "raw data" with all sales listed. The problem is, that first table lists customers by ID that is divided accross several columns in sales data (second table). Maybe it's better to show on example data (attached).
First table: Client ID (first column) is different by type. The type of ID is listed in second column (sorry, I can't install plugin to post in BB code, so I attach it as images)
Second table: "Raw data" that has all sales of all customers. No column is unique, but client is identified by first 3 columns (number, company, group). Raw data is stored in separate file.
Relation between tables depends on "ClientType" in first table. It should sum values either by column A, or column B or column C in raw data (table2)... Don't know how to get around this obstacle.
I did solve counting with nested (many) IF and SUMIFS formula, but it's both very slow and complicated to refresh data on client side. It would be much easier, if I could just replace raw data file on server and make Power BI read from it and sum values accordingly.
A formula solution to example. Real, final formula for real data is much longer (more types, more conditions):
Excel Formula:
=IF([@ClientType]="Number",SUMIFS(Tabela2[Sales Value],Tabela2[ClientNumber],[@ClientID]),IF([@ClientType]="Company",SUMIFS(Tabela2[Sales Value],Tabela2[ClientCompany],[@ClientID]),IF([@ClientType]="Group",SUMIFS(Tabela2[Sales Value],Tabela2[ClientGroup],[@ClientID]),0)))
Any tips how to proceed with getting data in table 1 by setting relation to Table 2?