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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
siddhantk989
Helper III
Helper III

How to create a static column in a table in power bi

Hi,

 

  I want to create a static column in a table in Power BI, i.e., the values of a particular column should not change if I change my slicer values. Below is the detailed explaination of scenarion:

 

I have the data as follows:

 

Data
CategoryParentSales
aabc100
adef200
babc300
bdef400

 

Now I am creating 3 measures for this data set. The first 2 are same to calculate sum and the 3rd is to find the difference between the 2.

 

3 measures
sales = SUM(Sales)
Total sales = SUM(Sales)
Relative Sales = total Sales - Sales

 

Then I am using Power bI table to show the following data:

 

Power BI Table
CategorySalesTotal SalesRelative Sales
a3003000
b7007000

 

and for slicer I am using Parent value as slicer

Filter
Parent
abc
def

 

Now if I am not selecting anything in this slicer I am getting my relative sales as 0 which is fine but if I select my Parent as abc for the filter

Filter
Parent
abc
def

 

I am expecting the below result:

 

Power BI Table
CategorySalesTotal SalesRelative Sales
a100300200
b300700400

 

In the above table you can see that the values of sales changes according to the filter but value of Total Sales remained static. So how do I get this functionality working in power BI?

1 ACCEPTED SOLUTION
Vvelarde
Community Champion
Community Champion

@siddhantk989

 

hi, replace TotalSales measure with:

 

Total sales = CALCULATE(SUM('Table'[Sales]),ALLEXCEPT('Table','Table'[Category]))



Lima - Peru

View solution in original post

2 REPLIES 2
Vvelarde
Community Champion
Community Champion

@siddhantk989

 

hi, replace TotalSales measure with:

 

Total sales = CALCULATE(SUM('Table'[Sales]),ALLEXCEPT('Table','Table'[Category]))



Lima - Peru

Thanks @Vvelarde The solution worked.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.