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
Anonymous
Not applicable

Rows & values disappear/merge when column is deselected

I have the following table of data:

Soft1 CompanySoft1 Computer NameSoft1 VersionSoft2 VersionSoft2 PolicySoft2 CompanySoft2 Computer Name
   #N/A#N/ARightWing#N/A
   #N/A#N/ALeftWing#N/A
   #N/A#N/AVeganWings#N/A
Water BottlesAQUAFINA12.651.223ProtectWatter BottlesAQUAFINA
Water BottlesDASANI12.61.554Protect & DefendWatter BottlesDASANI
TabletopsMARBLE11.441.764Protect & DefendTabletopsMARBLE
TabletopsGRANITE12.61.554ProtectTabletopsGRANITE
HoodiesCOTTON11.441.223Protect & DefendHoodiesCOTTON

 

I merge the "Soft1 Company"+"Soft2 Company" and "Soft1 Computer Name"+"Soft2 Computer Name" columns into 2 new columns (called "Company" & "Computer Name") with the calculated measures below:

 

Company = 
    VAR Client1 = SELECTEDVALUE('Sample'[Soft1 Company])
    VAR Client2 = SELECTEDVALUE('Sample'[Soft2 Company])
    RETURN SWITCH(
        TRUE(),
        EXACT(Client1, Client2), Client1,
        EXACT(Client1, ""), Client2,
        EXACT(Client2, ""), Client1,
        Client1
    )
Computer Name = 
    VAR Comp1 = SELECTEDVALUE('Sample'[Soft1 Computer Name])
    VAR Comp2 = SELECTEDVALUE('Sample'[Soft2 Computer Name])
    RETURN SWITCH(
        TRUE(),
        EXACT(Comp1, Comp2), Comp1,
        EXACT(Comp1, ""), Comp2,
        EXACT(Comp2, ""), Comp1,
        Comp1
    )

 

 

Then I want to hide the "Soft1 Company"+"Soft2 Company" and "Soft1 Computer Name"+"Soft2 Computer Name" columns so only the following data shows:

CompanyComputer NameSoft1 VersionSoft2 VersionSoft2 Policy
RightWing#N/A #N/A#N/A
LeftWing#N/A #N/A#N/A
VeganWings#N/A #N/A#N/A
Water BottlesAQUAFINA12.651.223Protect
Water BottlesDASANI12.61.554Protect & Defend
TabletopsMARBLE11.441.764Protect & Defend
TabletopsGRANITE12.61.554Protect
HoodiesCOTTON11.441.223Protect & Defend

 

However, I am forced to include the unnecessary Soft2 Company column for the above data to show, or else the 3 rows with "#N/A" data are merged and the Company column data disappears like this:

CompanyComputer NameSoft1 VersionSoft2 VersionSoft2 Policy
 #N/A #N/A#N/A
Water BottlesAQUAFINA12.651.223Protect
Water BottlesDASANI12.61.554Protect & Defend
TabletopsMARBLE11.441.764Protect & Defend
TabletopsGRANITE12.61.554Protect
HoodiesCOTTON11.441.223Protect & Defend

 

The odd thing is, the Filters options still indicate that all 3 "#N/A" data rows are visible when they aren't.

 

That probably doesn't make sense, so here's a video demonstrating the rows merging when I deselect the Soft2 Company column:

Produce_5.gif

I thought selecting the columns in the Fields area was just selecting which columns you want visible, and the columns visible shouldn't affect the dataset itself.

 

Can someone help me fix the dataset so rows don't disappear when columns are deselected? I'm sure there's a very obvious fault in my understanding/logic but I would appreciate someone kindly tell me how to avoid this. Thank you!

 

DisappearingRows.pbix download:

https://drive.google.com/file/d/1Z_P25Hfc_C6pTgC_k6jtS28LhVm0JJtj/view?usp=sharing 

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

I'll try and explain it.

Powerbi treats rows of the same data as duplicates (when they are in a visual).  This is because powerbi is all about aggregations.

Measures are evaluated in context i.e. what data is in filters, what data is in rows .

So, without the addition of Soft2 Company in the visual the Company measure has no context to return a value therefore powerbi sees the 3 rows as duplicates and shows them as one.

I'm pretty sure you can solve this by creating calculated columns rather than measures - this makes sense since the values are evaluated by row anyway.  You could even create the new columns in Power Query.

View solution in original post

2 REPLIES 2
HotChilli
Super User
Super User

I'll try and explain it.

Powerbi treats rows of the same data as duplicates (when they are in a visual).  This is because powerbi is all about aggregations.

Measures are evaluated in context i.e. what data is in filters, what data is in rows .

So, without the addition of Soft2 Company in the visual the Company measure has no context to return a value therefore powerbi sees the 3 rows as duplicates and shows them as one.

I'm pretty sure you can solve this by creating calculated columns rather than measures - this makes sense since the values are evaluated by row anyway.  You could even create the new columns in Power Query.

Anonymous
Not applicable

Sweet - Like I assumed,

I'm sure there's a very obvious fault in my understanding/logic

I just had to remove the `SELECTEDVALUE()` functions but was otherwise able to just copy-paste my Calculated Measures to Calculated Columns instead and it seems to have worked as intended. Thank you

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