Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Need Help with Power bi

I am stuck in one problem in Power Bi, any help would be appreciated.

I have two tables in power BI 1) Account 2) Sales
Account table has two columns 1) id 2) Owner
Sales has four column 1)Sales(YTD) 2)Accid 3) trader 4)Owner
I have built relationship between them by using unique id column from account table and id column from Sales table
Now the situation is that account table owner column represents the owner of the account,
But for that perticular account other owner can also do sales.
Now when I am trying apply filter to filter sales data based on owner it is only giving value for the account of which he is a owner
But I want all the account for which he has made the sales.

Please find sample data
Sales table

TraderYTDAccIDOwner
PASCAL SELTZER04480A27A-46B8-E811-A978-000D3AF49C6CPascal Seltzer
PASCAL SELTZER03AC1D8F1-F89B-EC11-B3FE-000D3A09D328Pascal Seltzer
DANIEL MADIO3,251.107C80A27A-46B8-E811-A978-000D3AF49C6CShaker Droubi
DANIEL MADIO2,595.7237EA4450-D698-E911-A982-000D3AF490CCDaniel Madio
MICHAEL POIRIER4,296.67B3A02A02-2C78-EA11-A811-000D3AF46489Michael Poirier
MICHAEL POIRIER2,595.7037EA4450-D698-E911-A982-000D3AF490CCDaniel Madio
RACHID BELKHADIR4,296.67B3A02A02-2C78-EA11-A811-000D3AF46489Michael Poirier
SHAKER DROUBI9,160.802836F63D-A875-EA11-A811-000D3AF46489Christopher Pratt


Account table

AccIDOwner
4480A27A-46B8-E811-A978-000D3AF49C6CPascal Seltzer
3AC1D8F1-F89B-EC11-B3FE-000D3A09D328Pascal Seltzer
7C80A27A-46B8-E811-A978-000D3AF49C6CShaker Droubi
37EA4450-D698-E911-A982-000D3AF490CCDaniel Madio
B3A02A02-2C78-EA11-A811-000D3AF46489Michael Poirier
2836F63D-A875-EA11-A811-000D3AF46489Christopher Pratt


Thanks for any help in advance.

10 Replies

  • Try

     

    Total sales by trader =
    CALCULATE (
        SUM ( Sales[YTD] ),
        REMOVEFILTERS ( Account ),
        TREATAS ( VALUES ( Account[Owner] ), Sales[Trader] )
    )
    

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks for your time and reply,
      It is not working as exepted.

      The thing is that I have one table visual with columns Accid from Account table and Sales, One filter with Owner coming from account table,
      Now when I am trying to filter data by selecting any owner from filter it is taking Owner from account matching it with owner column in sales table, Instead of that it should match it with Trader column in sales table.
      As per above sample, Suppose I am selecting 

      Daniel Madio

      Than output in table should be------Right

      7C80A27A-46B8-E811-A978-000D3AF49C6C
      3,251.10

      37EA4450-D698-E911-A982-000D3AF490CC

      2,595.72

       

      It is giving me output as----- Wrong

      37EA4450-D698-E911-A982-000D3AF490CC

      2,595.72

      37EA4450-D698-E911-A982-000D3AF490CC

      2,595.70
      • johnt75's avatar
        johnt75
        Icon for Super User rankSuper User

        I've edited my original post to use the correct column.