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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
HCC
Frequent Visitor

How do I create a measure to calculate column totals based on filters from other columns

Hi all, 

 

I am still new to Power BI but slowly learning! I am used to MS Excel functions but creating MEASURES are completely new to me.

 

As described in the subject, my goal is to create a measure that totals the monthly employment (shown below) by filtering three other columns as shown below: 

 

HCC_0-1672436660355.png

 

I have barely used measures before and I am a little stuck! Any help is greatly appreciated!!!

 

3 REPLIES 3
v-xinruzhu-msft
Community Support
Community Support

Hi @HCC 

You can use sumx() 

e.g sumx(filter(table,your expression),[month1_emplvl])

if the sample above cannot meet your requirement, can you provide more detail condition?

Best Regards!

Yolo Zhu

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

tamerj1
Super User
Super User

Hi @HCC 

how does your visual look like?

andrewpirie
Resolver II
Resolver II

Hi HHC,

 

I suggest using CALCULATE filter arguments to achieve this goal, it's a bit long but the sqlbi article here is a good read.

 

Here's a basic measure using static filters. Apologies for the lack of formatting.

 

[Sum of month1_emplvl ignoring a specific industry_code and area_fips] =
CALCULATE (
SUM('Sample Data'[month1_emplvl]),
'Sample Data'[industry_code] <> 111100,
'Sample Data'[area_fips] <> "C2683"
)

 

If you needed to get something like the sum of month1_emplvl with the same area_fips and Year & Quarter columns (regardless of industry_code), here's how you could do a count over all rows with the same values except a couple you want to filter out, and ignoring any differences in one of the columns.

 

[Sum of month1_emplvl except for 2022-Q1 and C2683] =
CALCULATE (
SUM('Sample Data'[month1_emplvl])
, REMOVEFILTERS('Sample Data'[industry_code])
, 'Sample Data'[Year & Quarter] <> "2022-Q1"
, 'Sample Data'[area_fips] <> "C2683"
)

 

If I've missed your intention, it could be helpful to have an example of how you'd filter and total using your above dataset in pseudocode or using Excel.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.