Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi All,
I am trying to achieve the values in the expected result column where I want to have an average of Values column where metric is headcount but sum of Values where metric on the row is Sales and Profit?
Please help, example is given below.
Two questions;
1) How can it be achieved it in clculated column?
2) How can it be achieved through DAX meaure using VAR ?
Solved! Go to Solution.
@Anonymous
Column =
IF (
'Table'[Metric] = "Head Count",
CALCULATE ( AVERAGE ( 'Table'[Value] ), ALLEXCEPT ( 'Table', 'Table'[Metric] ) ),
CALCULATE ( SUM ( 'Table'[Value] ), ALLEXCEPT ( 'Table', 'Table'[Metric] ) )
)
Hi @Anonymous ,
I created a sample pbix file(see attachment), please check whether that is what you want. You can create a calculated column or measure as below to get the values:
1. Create a calculated column just as suggested by @smpa01
Column =
IF (
'Table'[Metric] = "Head count",
CALCULATE (
AVERAGE ( 'Table'[Values] ),
ALLEXCEPT ( 'Table', 'Table'[Metric] )
),
CALCULATE ( SUM ( 'Table'[Values] ), ALLEXCEPT ( 'Table', 'Table'[Metric] ) )
)
2. Create a measure as below
Measure =
VAR _selmetric =
SELECTEDVALUE ( 'Table'[Metric] )
VAR _average =
AVERAGEX (
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Metric] = _selmetric ),
[Values]
)
VAR _sum =
SUMX (
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Metric] = _selmetric ),
[Values]
)
RETURN
IF ( _selmetric = "Head count", _average, _sum )
Best Regards
Hi @Anonymous ,
I created a sample pbix file(see attachment), please check whether that is what you want. You can create a calculated column or measure as below to get the values:
1. Create a calculated column just as suggested by @smpa01
Column =
IF (
'Table'[Metric] = "Head count",
CALCULATE (
AVERAGE ( 'Table'[Values] ),
ALLEXCEPT ( 'Table', 'Table'[Metric] )
),
CALCULATE ( SUM ( 'Table'[Values] ), ALLEXCEPT ( 'Table', 'Table'[Metric] ) )
)
2. Create a measure as below
Measure =
VAR _selmetric =
SELECTEDVALUE ( 'Table'[Metric] )
VAR _average =
AVERAGEX (
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Metric] = _selmetric ),
[Values]
)
VAR _sum =
SUMX (
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Metric] = _selmetric ),
[Values]
)
RETURN
IF ( _selmetric = "Head count", _average, _sum )
Best Regards
@Anonymous
Column =
IF (
'Table'[Metric] = "Head Count",
CALCULATE ( AVERAGE ( 'Table'[Value] ), ALLEXCEPT ( 'Table', 'Table'[Metric] ) ),
CALCULATE ( SUM ( 'Table'[Value] ), ALLEXCEPT ( 'Table', 'Table'[Metric] ) )
)
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
7 | |
5 | |
4 | |
3 |
User | Count |
---|---|
12 | |
11 | |
10 | |
9 | |
8 |