Forum Discussion

Deez's avatar
Deez
Icon for Advocate II rankAdvocate II
7 years ago

How to setup a table with 3 calculated columns

Hi,

 

I'm new to Dax and PowerBI and need some help with something that might be easy for you experts.

 

I have:

1 - Data Source

 

 

 

 

 

 

 

 

 

 

 

2 - Combine data into one table

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

What I need to achive is a  front end table visual with a dimension > ID and calculated columns for Source 1, Source 2 & STATUS.

It needs to be a front end table visual and not calculated in the query editor.

3 - Front End table with Calculated columns

 

 

 

 

 

 

 

 

 

 

 

The chalenge for me is the Dax query for "Source 1" & "Source 2".

For Source 1 to return the Name's (A,B,C...) where Source = 1
For Source 2 to return the Name's (A,B,C...) where Source = 2

 

And the STATUS i guess will be an If statement...

 

The aim here is to track the changes between the two sets of data.

 

Any Ideas?

3 Replies

  • Deez hey see attached solution. I did it with two methods.

     

    1st method, combined soure 1 and source 2, removed all the column except Id and made it distinct, called this table Source. created relation on id from source (new table) wiht source 1 and source 2. added new column called Status in Source (new table)

     

    2nd method, combined soure 1 and source 2, called this table SourceCombine. created 3 measures which you can check in attached file.

     

    PS - Ignore other tables in the file, those were for some other use case.

    • Deez's avatar
      Deez
      Icon for Advocate II rankAdvocate II

      Thank you parry2k for taking the time to help solve this problem!

      Just a question on method 2 which i am interested in using.

       

      What can we substitute the max function with if there are multiple values per ID  (The ID in my case is not unique per line)?

      Source 2 = CALCULATE( MAX( SourceCombine[Name] ), SourceCombine[Source] = 2 )

      Max would return one row with the maximum string for that ID. I would need to show all values for that non-unique ID.
       
      Something like ID 4 in the snap below:
       
       
       
       
       
       
      Any idea?
       
       
       
      • parry2k's avatar
        parry2k
        Icon for Super User rankSuper User

        Deez if you have more thn one value for an Id, I guess you have some other unique identifier which you need to include in your matrix visual. It is always good to post your question more close to real time data as solution could be totally different based on data model. FYI.