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!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I would like to create a new column that stores only the first average value of a date and fills the rest with 0. How do I do this?
Solved! Go to Solution.
Hi, @gelsonwj
You need to add an index column to the power query first.
Column:
Average =
Var _Aver=CALCULATE(AVERAGE('Table'[Quantity]),ALLEXCEPT('Table','Table'[Date_short]))
Var _minindex=CALCULATE(MIN('Table'[Index]),ALLEXCEPT('Table','Table'[Date_short]))
Return
IF([Index]=_minindex,_Aver,0)
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @gelsonwj
You need to add an index column to the power query first.
Column:
Average =
Var _Aver=CALCULATE(AVERAGE('Table'[Quantity]),ALLEXCEPT('Table','Table'[Date_short]))
Var _minindex=CALCULATE(MIN('Table'[Index]),ALLEXCEPT('Table','Table'[Date_short]))
Return
IF([Index]=_minindex,_Aver,0)
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @gelsonwj
please try
First Average =
VAR CurrentID = 'Table'[id]
VAR DateFarmIDTable =
CALCULATETABLE (
'Table',
ALLEXCEPT ( 'Table', 'Table'[Farm_id], 'Table'[Date_short] )
)
VAR FirstRecord =
TOPN ( 1, DateFarmIDTable, 'Table'[id] )
VAR MaxID =
MAXX ( FirstRecord, 'Table'[id] )
VAR FirstAverage =
MAXX ( FirstRecord, 'Table'[Average] )
RETURN
IF ( 'Table'[id] = MaxID, FirstAverage, 0 )
hi @gelsonwj
try to add a column with this:
Average2 =
VAR _average = [Average]
VAR _MaxID =
MAXX(
FILTER(TableName, TableName[Average] = _average ),
TableName[id]
)
RETURN
IF( [id] = _MaxID, _average, 0)
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 5 | |
| 5 | |
| 4 |
| User | Count |
|---|---|
| 24 | |
| 21 | |
| 15 | |
| 13 | |
| 13 |