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

Removing Nulls from Only One Parameter Field

Hello,

I have the following code for a Field Parameter I created in Power BI: 

Production Role = {
("Product Engineer", NAMEOF('Assignment'[Product Engineer]), 0),
("Intern", NAMEOF('Assignment'[Intern]), 1),
("Product Developer", NAMEOF('Assignment'[Product Developer]), 2)
}

On the visual side of things, I have a table created with information based off of these three Production Roles, and have it set up so that you can click between the three Production Roles and it will update the table and cards I have on the front end based off of that specific role. The issue I am having is that I don't want null names to show up for Intern because the blank names will influence the totals for different metrics I have set up in the table and cards (due to some assignments having a Product Developer or Product Engineer but no Intern. Every assignment has both a Product Developer and Engineer, but it is much more rare to have an Intern). So I want to not show the information for null Interns, but ONLY if the Production Role is Intern. Otherwise, I want the nulls to stay so that if there is an Product Developer or Product Engineer on an Assignment but not an Intern, those Assignments that don't have an Intern will still show up when I click on either the Product Developer or Product Engineer and give them their correct metric numbers on the table and cards. Any ideas?

1 ACCEPTED SOLUTION

Hi @KHeddens 
To achieve a goal you can take these few steps :

1 With power query replace "blanks " with null (until you do it the engine of pbi does not recognize these cells as blanks.

Ritaf1983_0-1712981155747.png

2. After creating field parameters add to the parameters table another column with the parameter name to have an ability to create conditions with it 

Ritaf1983_1-1712981273035.png

3 . Create a flag measure that will check which parameter was selected and if it is blank:

test_intern = if(SELECTEDVALUE('Parameter'[Test parametr])="Intern" && ISBLANK(max('Table'[Intern])),1,0)
Ritaf1983_2-1712981495857.png

4. Use this measure to filter the visual

Ritaf1983_3-1712981609141.pngRitaf1983_4-1712981629685.png

pbix is attached

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

View solution in original post

3 REPLIES 3
Ritaf1983
Super User
Super User

Hi @KHeddens 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

@Ritaf1983   Here is an example of the table named "Assignment."

AssignmentProduct EngineerProduct DeveloperInternTotal ProducedTotal Sold
232451Mannie JacobsonCarlie Abrams 341238
232452Jerrie VinlandJose Martinez 12199
232453Connie BanditMickie BarrettMariah Ham645561
232454Mannie JacobsonJose Martinez 222106
232455Connie BanditCarlie Abrams 9988
232456Mannie JacobsonCarlie AbramsMariah Ham561

498

 

Here is what the Field Parameter looks like, a standard field parameter based off of fields in the assignment table.

Production RoleParameter FieldsParameter Order
Product Engineer'Assignment'[Product Engineer]0
Product Developer'Assignment'[Product Developer]1
Intern'Assignment'[Intern]2


Now, this is what the tables look like on the front end, imagining that each table pops up when you click on the role tile based on the parameter, and the first row in the table is the role type.

Product EngineerTotal ProducedTotal Sold
Mannie Jacobson1124842
Connie Bandit744649
Jerrie Vinland12199
TOTAL19891590

 

Product DeveloperTotal ProducedTotal Sold
Carlie Abrams1001824
Jose Martinez343205
Mickie Barrett645561
TOTAL19891590

 

InternTotal ProducedTotal Sold
 783531
Mariah Ham12061059
TOTAL19891590


So here you can see that nulls are pulling in for Interns, even though I only want the TRUE intern totals. The other two charts are perfectly fine as there are no nulls and nothing is skewing the data, so we want to make sure the assignments that have interns that are null are still pulling product developers and engineers so that their totals are correct. But imagine if there were many many more rows and more interns, they could see their personal totals, but managers would not be able to see the production of interns as a whole. So I want to be able to have this parameter set up where you can click on a slicer role tile and switch between the three roles to see the three charts I have put aboce, but only have to make the one chart thanks to parameters. But I want to take out null role names so that the totals are correct.

Hi @KHeddens 
To achieve a goal you can take these few steps :

1 With power query replace "blanks " with null (until you do it the engine of pbi does not recognize these cells as blanks.

Ritaf1983_0-1712981155747.png

2. After creating field parameters add to the parameters table another column with the parameter name to have an ability to create conditions with it 

Ritaf1983_1-1712981273035.png

3 . Create a flag measure that will check which parameter was selected and if it is blank:

test_intern = if(SELECTEDVALUE('Parameter'[Test parametr])="Intern" && ISBLANK(max('Table'[Intern])),1,0)
Ritaf1983_2-1712981495857.png

4. Use this measure to filter the visual

Ritaf1983_3-1712981609141.pngRitaf1983_4-1712981629685.png

pbix is attached

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

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.