Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ShaunBizSol
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
v-qiuyu-msft
Community Support
Community Support

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.

View solution in original post

3 REPLIES 3
v-qiuyu-msft
Community Support
Community Support

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.

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

Greg_Deckler
Super User
Super User

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.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors