cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
Krish4Work
Frequent Visitor

How to get values from a row and transpose it to columns.

Hi.. I am pretty new to Power BI

I have two tables, one For the transaction Document and another for the Tender details of the transaction.

In the tender tables, for every tender it will create a row with the tender type (eg: Cash, Master Card, Visa etc) and the tender amount.

Even if a single transaction has multiple tenders (Split tenders) like cash and one of the cards, it has multiple record of rows for each tender type.

The tender table contains Transaction SID which is the reference to the Transaction Document.

 

My requirement is to Create coloumns according to the multiple tender type(Cash, mastercard, visa) which will contain the tender amount as values and group it according to the transaction SID.

 

I tried adding a custom coloumn with

Cash = LOOKUPVALUE(TENDER[AMOUNT],TENDER[DOC_SID],DOCUMENT[SID],TENDER[TENDER_TYPE],0)

but it gives an error

A table of multiple values was supplied where a single value was expected.

Please help me out in this.

Thanks in advance.

1 ACCEPTED SOLUTION

Hi @Krish4Work 
Please refer to attached sample file. Hope this is what you're looking for

1.png

Cash = 
SUMX (
    FILTER ( 
        RELATEDTABLE ( TENDER ),
        TENDER[TENDER_TYPE] = 0
    ),
    TENDER[AMOUNT]
)

View solution in original post

4 REPLIES 4
tamerj1
Super User
Super User

Hi @Krish4Work 
Do you have a relationship between the two tables? Can you please provide sample data from both tables along with the expected result?

Hi @tamerj1

Thanks for replying!

Please find the .pbix file in this attached wetransfer link.

 https://we.tl/t-eZ5i7pp6ty 

Both the tables have relatioship ie Tender[Doc_sid] = Document[sid].

Hi @Krish4Work 
Please refer to attached sample file. Hope this is what you're looking for

1.png

Cash = 
SUMX (
    FILTER ( 
        RELATEDTABLE ( TENDER ),
        TENDER[TENDER_TYPE] = 0
    ),
    TENDER[AMOUNT]
)

Thankyou @tamerj1  you've been a great help.

Your solution is working for me.

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors