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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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