cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
PowerBIuser_2
New Member

Filter pie chart based on USERPRINCIPALNAME

Hi, 

I have the following table1:

TaskStatususer1user2
1CompletedOtherOther
2CompletedUSERPRINCIPALNAMEOther
3PendingOtherUSERPRINCIPALNAME
4PendingUSERPRINCIPALNAMEOther
5PendingOtherOther

 

And I've added the following measure:

Measure1 = IF(

table1[user1]=USERPRINCIPALNAME ||

table1[user2]=USERPRINCIPALNAME,

1,0).

 

How should I include a pie chart that filters by USERPRINCIPALNAME, and therefore returns 3 tasks according to the example table: 1 completed and 2 pending?

Thanks for your support.

 

1 ACCEPTED SOLUTION

I found the solution with the following measure:

Measure2 = CALCULATE(COUNT(table1[Status],

table1[user1]=USERPRINCIPALNAME() ||

table1[user2]=USERPRINCIPALNAME()

)

View solution in original post

5 REPLIES 5
meenakp
Resolver I
Resolver I

@PowerBIuser_2, Calculate a fifth column say "final user" - to populate with "USERPRINCIPALNAME" if user1 or user2 = USERPRINCIPALNAME. Filter by this "final user" column.

I found the solution with the following measure:

Measure2 = CALCULATE(COUNT(table1[Status],

table1[user1]=USERPRINCIPALNAME() ||

table1[user2]=USERPRINCIPALNAME()

)

@meenakp Power BI gives me the following error: USERPRINCIPALNAME function is not supported on calculated columns

PowerBIuser_2
New Member

Hi @Greg_Deckler,

Thanks for your quick response.
I don't use RSL, because in my dashboard I also have a table that I apply the Measure1 in the filter (Measure1 is "1") and only the USERPRINCIPALNAME tasks appear.

My problem is with the pie chart. In Details section I can put the user1 and then the filter with the Measure1 works fine, but only apply the filter for the user1 column. I need take in account both columns: user1 & user2, as the table does.

The table show me 3 task as a USERPRINCIPALNAME (it's correct), but I don't get the same result in the pie chart...

Greg_Deckler
Super User
Super User

@PowerBIuser_2 Use RLS?Row-level security (RLS) with Power BI - Power BI | Microsoft Learn


@ 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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors