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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
NrAg
Frequent Visitor

Hardcoded Column expands table visual by all values

Hi all, 

 

I have the following problem that I would like to add a column with a hardcoded value (either a string or number) but would like to add the value only to the currently displayed rows of the visual. The visual is a table and conststs of columns from three different dimensional tables (Calendar, Dim City & Dim StockItem). The problem is the following: As soon as I add that measure the table get expanded by all rows available. Can anyone tell me what I am getting wrong? 

Below is the table without the measure:

NrAg_0-1661350741102.png


This is the expanded version of the table after I have added a measure that should only add a column with the value 1 in it.

NrAg_1-1661350810076.png


Your help is very much appreciated!

1 ACCEPTED SOLUTION
NrAg
Frequent Visitor

In case others have to add a dummy column with a hardcoded value to a table visual I wanted to provide the way I could solve it.

First approach:

 

NrAg_0-1661881369331.png

The problem with creating a measure that just contains the value and then throwing it into the visual as the other columns is that it has no relation to the tables and columns used in the visual. Thus, it doesnt know for which rows of the two tables the measure should be displayed and therefore, it shows all rows. 
--> doesn't work!

 

Second approach:

 

NrAg_1-1661882150849.png

I created a measure that consist of a variable that checks whether a vlaue of a specific column is selected by using the SELECTEDVALUE function. Afterwards, I checked in a IF condition whether this selected value is not blank and if not returned my hardcoded column. The function doesnt understand the interconnection of the three dimensional tables either and will display all rows as well. So I tried to create a variable for all three columns and the respective rows selected and checked them in the IF clause but with no success.
 --> doesn't work!

 


Third approach (and this is the winner):

 

NrAg_4-1661882804343.png

While working on the second solution I finally got the idea. The SELECTEDVALUE wont understand the relationship when selected a column from the dimensional table. But these three tables are connected by the Fact table (FactSale) and this is also the factor why only specific colors have been displayed for specific states for my selected date. Therefore, I just needed to check for the delivery date column in the fact table (which was used for the relationship between the two) and check which values are selected and then assign the respective dummy value to it.

 

NrAg_5-1661882819625.png


Of course, it is debatable why creating a hardcoded column to a table visual but I guess sometimes it is beyond our power to decide what stakeholders want to look at in their reports. Below you can see the final result. 

--> does work!

 

If anyone has another solution please feel free to share cause I am wondering if there are other ways to solve that. 🙂 

 

 

 

 

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@NrAg So what is filtering the top table? Why aren't the additional rows being displayed? Is there another measure in your table visual or are you doing some kind of filtering in the filter pane or ?



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

The top table is filtered by the date and shows all combinations available of the fact table FactSale. Below is the Model view. The measure so far is just: dummy_selected = 1

NrAg_0-1661358000141.png


That would be the result of the fact Table if filtered by the 04.01.2022. I added to calculated columns with the related results from the dimensional tables.

NrAg_0-1661360631354.png

 

There are no other measures involved. I just want to add dummy columns to the table visual.

Additional info: I cannot create calculated columns for the dummy values. It is necessary to pull them via a measure into the visual (table).

NrAg
Frequent Visitor

In case others have to add a dummy column with a hardcoded value to a table visual I wanted to provide the way I could solve it.

First approach:

 

NrAg_0-1661881369331.png

The problem with creating a measure that just contains the value and then throwing it into the visual as the other columns is that it has no relation to the tables and columns used in the visual. Thus, it doesnt know for which rows of the two tables the measure should be displayed and therefore, it shows all rows. 
--> doesn't work!

 

Second approach:

 

NrAg_1-1661882150849.png

I created a measure that consist of a variable that checks whether a vlaue of a specific column is selected by using the SELECTEDVALUE function. Afterwards, I checked in a IF condition whether this selected value is not blank and if not returned my hardcoded column. The function doesnt understand the interconnection of the three dimensional tables either and will display all rows as well. So I tried to create a variable for all three columns and the respective rows selected and checked them in the IF clause but with no success.
 --> doesn't work!

 


Third approach (and this is the winner):

 

NrAg_4-1661882804343.png

While working on the second solution I finally got the idea. The SELECTEDVALUE wont understand the relationship when selected a column from the dimensional table. But these three tables are connected by the Fact table (FactSale) and this is also the factor why only specific colors have been displayed for specific states for my selected date. Therefore, I just needed to check for the delivery date column in the fact table (which was used for the relationship between the two) and check which values are selected and then assign the respective dummy value to it.

 

NrAg_5-1661882819625.png


Of course, it is debatable why creating a hardcoded column to a table visual but I guess sometimes it is beyond our power to decide what stakeholders want to look at in their reports. Below you can see the final result. 

--> does work!

 

If anyone has another solution please feel free to share cause I am wondering if there are other ways to solve that. 🙂 

 

 

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.