Forum Discussion

buck1327's avatar
buck1327
Frequent Visitor
1 year ago
Solved

Create table visualization using two different columns from the semantic model data

Hello,

 

I am using Power BI Service to build a table visualization A based on existing semantic model, whcih has columns of "Orig_City", "Dest_City", "Sales", "Date"

Is it possible to build the table visualization A with City(including Orig_City and Des_City), Total_Sales, i.e append Orig_city, Total_sales on top of Dest_city, Total_sales, based on some filters?

 

Question #2, if City Total_Sales table visualization A is successfully built, is it possible to reference City, Total_Sales data in table visualization B which on the same page? so table visualization B will have City,  New_sales, Total_Sales( referencing from table visualization A)?

 

Thank you for your help

 

  • Hey buck1327 ,

     

    In Power BI Service, you can go to the EDIT option and then go to Data Model.  And then, right click on the Model and select Calculated Table.  Then, you can put in the appropriate DAX to do what you want.

    You can tweak this as you need, but this is a good first pass for you DAX:
    Combined_City_Sales =
    UNION (
    SELECTCOLUMNS (
    YourTableName,
    "City", YourTableName[Orig_City],
    "Total_Sales", YourTableName[Sales]
    ),
    SELECTCOLUMNS (
    YourTableName,
    "City", YourTableName[Dest_City],
    "Total_Sales", YourTableName[Sales]
    )
    )

     

     

    As for Question 2, I think that you will be able to link or otherwise refer to the fields that you want.

9 Replies

  • Hey buck1327 ,

     

    In Power BI Service, you can go to the EDIT option and then go to Data Model.  And then, right click on the Model and select Calculated Table.  Then, you can put in the appropriate DAX to do what you want.

    You can tweak this as you need, but this is a good first pass for you DAX:
    Combined_City_Sales =
    UNION (
    SELECTCOLUMNS (
    YourTableName,
    "City", YourTableName[Orig_City],
    "Total_Sales", YourTableName[Sales]
    ),
    SELECTCOLUMNS (
    YourTableName,
    "City", YourTableName[Dest_City],
    "Total_Sales", YourTableName[Sales]
    )
    )

     

     

    As for Question 2, I think that you will be able to link or otherwise refer to the fields that you want.

    • buck1327's avatar
      buck1327
      Frequent Visitor

      I appreciate your help, but I am not sure where is the EDIT option on Service, any screenshot if possible

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi buck1327,

        Thank you for following up with the conversation. In Power BI Service, there is no direct "Edit" option for Data Model changes like it is in Power BI Desktop. Your confusion likely comes from the fact that calculated tables can only be created in Power BI Desktop and then published to the Power BI Service. Power BI Service you can edit visuals and filters, but not modify the data model like creating calculated tables directly. You must edit the data model in Power BI Desktop, create the calculated table, and then publish the report to Power BI Service.

         

        If I misunderstand your needs or you still have problems on it, please feel free to let us know.  

        Best Regards,
        Hammad.
        Community Support Team

         

        If this post helps then please mark it as a solution, so that other members find it more quickly.

        Thank you.

         

  • Hello,

     

    To clarify the first part, is this what you're looking for? (Mockup in Excel)

     

     

  • buck1327's avatar
    buck1327
    Frequent Visitor

    Thank you for help. The same city (e.g. Boston) can only be in either orig_city and Dest_city.  other than that, your mockwup data is very good

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi buck1327,

    Thanks for reaching out to the Microsoft fabric community forum.

     

    As you went through the response given by collinq, were you able to solve your issue? If yes then please mark the helpful response as solution.

     

    I would also take a moment to thank collinq and hansontm for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.

     

    If I misunderstand your needs or you still have problems on it, please feel free to let us know.  

    Best Regards,
    Hammad.
    Community Support Team

     

    If this post helps then please mark it as a solution, so that other members find it more quickly.

    Thank you.