Forum Discussion

AlakarHarijan1's avatar
AlakarHarijan1
Frequent Visitor
6 years ago

Create a new table from a existing one

Hi Friends,

 

I have a table from which i have to summaris data in to new table.

The first table contains columns - client name, region, fee(Paid/Not Paid), etc.

 

Basically i want to create a new table showing the data by client wise (say for just client "A", region in the row and count of paid in the next column the count of not paid int the next column.

 

I need the dax code. Can anyone help me please.

3 Replies

  • v-zhenbw-msft's avatar
    v-zhenbw-msft
    Icon for Community Support rankCommunity Support

    Hi AlakarHarijan1 ,

     

    Sorry for that we don’t understanding what is your desire result.

    If you want to get the sum of revenue, you need to replace the sheet1[Paid Count] to sheet1[revenue]. The Power BI cannot get the sum of text type value.

     

    Table =
    SUMMARIZE (
        Sheet1,
        Sheet1[Region],
        "Paid Calls", COUNTX (
            FILTER (
                Sheet1,
                Sheet1[Stakeholder Code] = "UNIV"
                    && Sheet1[Paid Count] = "Paid"
            ),
            Sheet1[Paid Count]
        ),
        " Not Paid Calls", COUNTX (
            FILTER (
                Sheet1,
                Sheet1[Stakeholder Code] = "UNIV"
                    && Sheet1[Paid Count] = "Not Paid"
            ),
            Sheet1[Paid Count]
        ),
        "Total", COUNTX (
            FILTER ( Sheet1, Sheet1[Stakeholder Code] = "UNIV" ),
            Sheet1[Paid Count]
        ),
        " Revenue Received ", SUMX (
            FILTER (
                Sheet1,
                Sheet1[Stakeholder Code] = "UNIV"
                    && Sheet1[Paid Count] = "Paid"
            ),
            Sheet1[revenue]
        )
    )

     

    If it doesn’t meet your requirement, could you please provide a mockup sample  based on fake data?

     

    It will be helpful if you can show us the exact expected result based on the tables. Please upload your files to OneDrive For Business and share the link here.

     

    Please don't contain any Confidential Information or Real data in your reply.

     

    Best regards,

     

    Community Support Team _ zhenbw

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • AlakarHarijan1 so I guess you have paid and unpaid, for each row, one column is blank with no value  or it is a zero value?

    • AlakarHarijan1's avatar
      AlakarHarijan1
      Frequent Visitor

      Hi Parry,

       

      Thanks for reply, i have figured out a way to get it solved. using below code.

       

      Table = SUMMARIZE(Sheet1,Sheet1[Region],"Paid Calls",COUNTX(FILTER(Sheet1,Sheet1[Stakeholder Code]="UNIV"&&Sheet1[Paid Count]="Paid"),Sheet1[Paid Count])," Not Paid Calls",COUNTX(FILTER(Sheet1,Sheet1[Stakeholder Code]="UNIV"&&Sheet1[Paid Count]="Not Paid"),Sheet1[Paid Count]),"Total",COUNTX(FILTER(Sheet1,Sheet1[Stakeholder Code]="UNIV"),Sheet1[Paid Count]))

       

      but now facing difficulty in some thing else.

       

      Now I want to get the sum of revenue using below code.

       

      Table = SUMMARIZE(Sheet1,Sheet1[Region],"Paid Calls",COUNTX(FILTER(Sheet1,Sheet1[Stakeholder Code]="UNIV"&&Sheet1[Paid Count]="Paid"),Sheet1[Paid Count])," Not Paid Calls",COUNTX(FILTER(Sheet1,Sheet1[Stakeholder Code]="UNIV"&&Sheet1[Paid Count]="Not Paid"),Sheet1[Paid Count]),"Total",COUNTX(FILTER(Sheet1,Sheet1[Stakeholder Code]="UNIV"),Sheet1[Paid Count])," Revenue Received ",SUMX(FILTER(Sheet1,Sheet1[Stakeholder Code]="UNIV"&&Sheet1[Paid Count]="Paid"),Sheet1[Paid Count]))

       

      But its giving error.

       

      Can you please help me with it.