Forum Discussion

cristianj's avatar
cristianj
Icon for Helper IV rankHelper IV
4 years ago

How to use a filter for 2 tables, filter which contains same data, but can;t join table

Hello 

I have 2 tables one which contains sales and one with Warranties, i cant use a relation between those 2 table, they are allready joined by the data field, the problem is that both of them contains a field name Country, with data is identical, is there a way to use a single slicer, to filter both of them at the same time? so i don't use 2 country slicers?

Thank you

6 Replies

  • Hi,

    When asking a question about datamodelling and relationships, it's a good idea to include a picture of your datamodel and description of relationships.
    Check out this thread for further explainiation:
    https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523#M607150

    That being said, you might look into incorporation Dimension tables into your datamodel. I'm sure you preferred PowerBi youtuber will have a video on this.

  • AliceW's avatar
    AliceW
    Icon for Power Participant rankPower Participant

    If the connection between the table is one-to-many, use the Country field in the table in the 'one' section.

    It should filter both.

  • Hello there cristianj ! What you need is a dimension table to connect both of the different "sides" of the company you want to analyze. In attachment you'll find some links that will guide in understanding what are Fact and Dimension Tables and how to apply them to Power BI in order to obtain the needed star schema. Summing up, what you need is a Country Dimension table that contains the CountryID (hopefully) and the Country Name that allows to connect to the Sales and Warranties table via a one-to-many relationship with each.

     

    Fact vs. Dimension Tables in Power BI - Kumo Partners

    Why and how to Keep Dimensions & Facts tables separate - DAX modeling (theexcelclub.com)

    Understand star schema and the importance for Power BI - Power BI | Microsoft DocsPower BI Basics of Modeling: Star Schema and How to Build it - RADACAD

     

    Alternatively, you can use the TREATAS() function to propagate filters to unrelated tables.

     

    TREATAS function - DAX | Microsoft Docs

     

    Hope this answer solves your problem!
    If you need any additional help please @ me in your reply.
    If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍
    Thanks!

    You can also check out my LinkedIn!

    Best regards,
    Gonçalo Geraldes

    • cristianj's avatar
      cristianj
      Icon for Helper IV rankHelper IV

      Hello, this is my data model,

      in fact i don;t need to filter all info, just to calculate, sum(ordersSM[TelefVandute]), if i select a timeframe in date - something like a month, i want to know, number of Warranty, interval, and the  sum(ordersSM[TelefVandute]) for that period, and maybe filtered by contry and model . it would be better if i use a measure i think

      Thank you

       

      • goncalogeraldes's avatar
        goncalogeraldes
        Icon for Super User rankSuper User

        Helo there cristianj ! Beware of extensive use of calculated columns. Due to the difference between Measures and Calculated Columns, you should always consider carefully which one to choose. There isn't a clear choice between which each one so you should consider the context of your model. However, my recommendation would be to avoid Calculated Columns in Fact tables as much as possible, specially in "heavy models" since they are going to be a burden on the refresh. Please use the following link for further documentation:

         

        Calculated Columns and Measures in DAX - SQLBI

         

        Regarding your question on filters, it is always better to model your data according to Power BI's best practices. Therefore, having a Country Dimension and a Model Dimension would be the best direction to go for now.

         

        Hope this answer solves your problem!
        If you need any additional help please @ me in your reply.
        If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍
        Thanks!

        You can also check out my LinkedIn!

        Best regards,
        Gonçalo Geraldes

         

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi cristianj,

    Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or accept the helpful suggestions to help others who faced similar requirements.

    If these also don't help, please share more detailed information to help us clarify your scenario to test.

    How to Get Your Question Answered Quickly 

    Regards,

    Xiaoxin Sheng