cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
ShaunBizSol Frequent Visitor
Frequent Visitor

Same data in two columns. Need to visualise values within a table referencing the same name.

Hi all,

 

Novice here. With an issue in how to show data in a certain way.

 

Effectively, we are attempting to visualise two or three columns, that have a number within relating to a specific name held in two separate columns. However the name can either be under the name1 or name2 column. This is the challenge we are facing.

We want to get the rows with "a" within it to report out on visualisations without including anything that doesn’t have "a" in it. Here is some dummy data. We also want to see each line individually and have been using the matrix visual which works well except it will only show the data from either Name1 or Name2, and now showing us both. Using splicers to narrow the certain name.

 

 

Name1

Name2

Name1 Number

Name2 Number

a

b

10

20

a

c

10

30

a

d

30

10

a

b

10

20

b

a

40

10

b

a

50

10

c

a

60

30

b

d

40

20

c

e

40

10

 

I have attempted to do a calculated column, which is the below: And it unfortunately just adds up the total of the line with "a" in it.

 

if [Name1]="a" or [Name2]="a" then [Name1 Number]+[Name2 Number] else 0

 

Any assistance would be greatly appreciated.

 

Thanks

 

1 ACCEPTED SOLUTION

Accepted Solutions
Moderator v-qiuyu-msft
Moderator

Re: Same data in two columns. Need to visualise values within a table referencing the same name.

Hi @ShaunBizSol,

 

You can also use DAX like below. You can check attached .pbix file.

 

Table = UNION(SELECTCOLUMNS('Table1',"Name1",'Table1'[Name1],"Value1",'Table1'[Name1 Number]),SELECTCOLUMNS('Table1',"Name2",'Table1'[Name2],"Value1",'Table1'[Name2 Number]))

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 REPLIES 3
Super User
Super User

Re: Same data in two columns. Need to visualise values within a table referencing the same name.

I think what you need to do is to create 3 queries. The first query imports Name1 and Name 1 Number only and I would add an Index. The second query imports Name 2 and Name 2 Number only and also add an Index. Then create an append query to append them together.


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!


Moderator v-qiuyu-msft
Moderator

Re: Same data in two columns. Need to visualise values within a table referencing the same name.

Hi @ShaunBizSol,

 

You can also use DAX like below. You can check attached .pbix file.

 

Table = UNION(SELECTCOLUMNS('Table1',"Name1",'Table1'[Name1],"Value1",'Table1'[Name1 Number]),SELECTCOLUMNS('Table1',"Name2",'Table1'[Name2],"Value1",'Table1'[Name2 Number]))

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ShaunBizSol Frequent Visitor
Frequent Visitor

Re: Same data in two columns. Need to visualise values within a table referencing the same name.

You are a life savor. I have applied this to our actual data set, added a few additional columns and its working perfectly.

 

Thank you very much for your help

Shaun