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

Sumup Column based on Filter as Calculated Column

Hi Guys, Can someone help to get the formula in a calculated Column. (I derived it in Measure, but i need the same calculation in Calculated Column).

Measure Formula: Current Month Total = CALCULATE( SUM('Table1'[Month 1]), 'Table1'[Class] IN { "A" } ) 

how to get this done with Calculated Column?
Note: I need this Calculated Column since i was unable to add the Measure as "Page filter"
Thanks.

 

ClassMonth 1Month 2Month 3
A102022
B1213123
A131412
1 ACCEPTED SOLUTION

hi  @Anonymous 

4.JPG

Do you want show this expected output in power bi calculated table?

If so, you need to create a new table like below:

New table = SUMMARIZE(Table1,Table1[Subject],"Month 1",CALCULATE(SUM(Table1[Month1]),FILTER(Table1,Table1[Class]="A")))

Result:

5.JPG

 

here is sample pbix file, please try it.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-lili6-msft
Community Support
Community Support

hi  @Anonymous 

Just adjust the formula as below:

CALCULATE( SUM('Table1'[Month 1]), FILTER(ALL(Table1),'Table1'[Class] IN { "A" } ))
 
Regards,
Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@v-lili6-msft  this formula which you provided sums all i guess.., i am not getting the value only for that particular selection. 😞

amitchandak
Super User
Super User

Create a column like

Current Month = if('Table1'[Class] IN { "A" },'Table1'[Month 1],blank() )

and choose Agg sum when use.

But I not clear with data model you posted.

In case you are looking for slicer to give you which measure then refer

https://community.powerbi.com/t5/Desktop/Slicer-MTD-QTD-YTD-to-filter-dates-using-the-slicer/td-p/50...

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Connect on Linkedin

Anonymous
Not applicable

@amitchandak this doesnt gives the correct value.., All i need is to filter "A" in Class and get the Month1 data for all A in calculated Column. Below is my exact version of data which i loaded in Power BI. 

SubjectClassMonth1
MathsA10
MathsB13
MathsA11
ComputerA24

 

The value which i expect is in Power BI Table is:

 

SubjectMonth 1
Maths21
Computer24

 

it just filter only "A" and provide the value against it.

Measure Formula which works: Current Month Total = CALCULATE( SUM('Table1'[Month 1]), 'Table1'[Class] IN { "A" } ) 

and same formula i need in Calcluated Column...

hi  @Anonymous 

4.JPG

Do you want show this expected output in power bi calculated table?

If so, you need to create a new table like below:

New table = SUMMARIZE(Table1,Table1[Subject],"Month 1",CALCULATE(SUM(Table1[Month1]),FILTER(Table1,Table1[Class]="A")))

Result:

5.JPG

 

here is sample pbix file, please try it.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thank you @v-lili6-msft it works 🙂 thanks a lot.., 

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.