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.
Hi, I am trying to get previous date in the current row. somehow it works without [Name] column but as soon as [Name] gets included, it shows blanks as below. I hope to someone explains the reason why.
(The raw data is simple with name, date & price)
Thank you
Solved! Go to Solution.
Hi @colacan
This is not just a problem with the [Nmae] column. If you add the [Price] column, you will get the same result, as shown below.
Please note the part of the code circled in red.
When filter expressions are provided, the CALCULATETABLE function modifies the filter context to evaluate the expression. The CALCULATETABLE function used without filters achieves a specific requirement. It transitions row context to filter context.
For more information, please refer to:
CALCULATETABLE function (DAX) - DAX | Microsoft Docs
Best regards,
Yadong Fang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @colacan
This is not just a problem with the [Nmae] column. If you add the [Price] column, you will get the same result, as shown below.
Please note the part of the code circled in red.
When filter expressions are provided, the CALCULATETABLE function modifies the filter context to evaluate the expression. The CALCULATETABLE function used without filters achieves a specific requirement. It transitions row context to filter context.
For more information, please refer to:
CALCULATETABLE function (DAX) - DAX | Microsoft Docs
Best regards,
Yadong Fang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
(지환 후배님 반갑습니다. 전 통계92입니다.)
Unfortunately, I am not looking for the solution using FILTER(all(table), ... or FILTER(all(table[date]), due to the permermance issue. I am still looking for the REASON why above error of making the [prevdate] blank when the Name column gets included. it must be context problem which I can't figure out. Thanks.
Hi,
I am not sure if I understood your question correctly, but please try the below measure.
The reason is,
inside calculatetable DAX function, your measure only removes TestTable[Date] column.
I think TestTable[Name] column also has to be removed.
Prevdate =
VAR currentdate =
MAX ( TestTable[Date] )
VAR prevdate =
MAXX (
CALCULATETABLE (
TestTable,
FILTER ( ALL ( TestTable ), TestTable[Date] < currentdate )
),
TestTable[Date]
)
RETURN
prevdate
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
42 | |
26 | |
22 | |
11 | |
8 |
User | Count |
---|---|
75 | |
50 | |
47 | |
17 | |
17 |