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
tranmtrang
New Member

How to use IF(Selectedvalue)

HI Everyone. I'm learning how to use PowerBI desktop and I'm new to the forum. I hope everyone could help me with this.

I imported 2 excel files, each has 5 tables that are almost identical. They are pre and post conversion results in number of outstanding units.

I created measure of % of ownership for both set of data.

I linked these two set of data by employee Unique ID table. Using ID from this employee ID table, then select pre conversion or post conversion, it returned the correct number of outstanding units. However, the percentage returned 100% for all employees.

 

When I pull employee ID from pre conversion table, it gives me correct % of ownership for each employee, same as for post conversion.

Select Outstanding Units = IF(SELECTEDVALUE('Select Period'[Period])= "Pre Conversion", 'Select Period'[Pre-C Outstandings],'Select Period'[Post-C Outstandings])
Select % = IF(SELECTEDVALUE('Select Period'[Period]) = "Pre Conversion", [% Ownership Pre-C],[% Ownership Post-C])

 

How can I get the correlated % of ownership when select pre-conversion or post conversion by selecting the employee ID from the joined table? 

 

Your help is much appreciated.

2 REPLIES 2
tranmtrang
New Member

Stakeholder IDNameOutstanding Units
1John Smith100
2Mary Smith 200
3Jones Brown300
4James Swenson400
Stakeholder IDNameOutstanding Units
1John Smith150
2Mary Smith 200
3Jones Brown300

 

So the first table with 4 stakeholders is the pre-conversion table, the second one with 3 stakeholders is the post conversion. I joined these 2 tables 1:1. 

 

I created measure to get % ownership for each stakeholder in each table: % Ownership Pre COnversion and % Ownership Post Conversion. 

 

I created a table as SELECTED PERIOD with only 1 colum and 2 rows for selection of Pre Conversion, Post Conversion, in order to use the IF(SELECTEDVALUE) 

 

I added slicer to the page by filter names from the first table (4 stakeholders). 

When I select Pre COnversion or Post conversion for John Smith for example: the % Ownership show 100% for him in both cases. 

 

However, when I pull %ownership pre conversion in the field with the pre conversion name table, I get the correct % ownership. For example in John Smith case, it is 10% pre conversion. Similar to post conversion, % ownership for John Smith is 23% which is correct. 

 

I hope this help explain my question. And thank you so much for your time trying to help me on this.

amitchandak
Super User
Super User

@tranmtrang ,The information you have provided is not making the problem clear to me. Can you please explain with an example.
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
Appreciate your Kudos.

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.