Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I am new to DAX and trying learn it. So I am essentially looking for an explanation as to what is causing the error.
Following formula works fine
AverageX = Averagex(
VALUES('Date'[Date]
)
,Fact_Hours[SUM Hours]
)
However, if I remove the VALUES function, I end up with an error I mentioned in the title of this question
AverageX = Averagex(
'Date'[Date]
)
,Fact_Hours[SUM Hours]
)
Date column in Date table has unique values already. Why is VALUES function needed?
Also, for second argument to AVERAGEX, Measure works. But if I try to put a column that is already a part of model, it would not. Why would that be?
Hi @tvaishnav
Iteration functions requires a table as first argument. VALUES is a function that creats a table contains the unique values in a column. You cannot refer the column directly.
Iteration functions creat a filter context over the tablw under iteration. Only the columns that belongs to this table can be refrenced directly. Columns from related tables in the "one" side of the relationship can be referenced using RELATED function. The "many" side related table can be referenced using RELATEDTABLE functions which bring a set of rows from the "many" side table which are realted to the current row on the iteration. In this case an aggregation must be provided in order to evaluate any column from this related table.
on the other hand CALCULATE function can be used to perform context transition in irder to evaluate columns from rekated tables. In this case aggregation shall be provided. Remember that any refrenced measure is automatically wrapped with CALCULATE.
please let if you still have any doubts
@tvaishnav Because you have an errant paren ). The second formula should be:
AverageX = Averagex(
'Date'[Date]
,Fact_Hours[SUM Hours]
)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
9 | |
8 | |
8 | |
7 |
User | Count |
---|---|
14 | |
12 | |
11 | |
10 | |
9 |