Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi,
I've looked through many similar posts and can't quite get to what I need.
So far there is a calculated column to convert the year to a numeric year
Year4 = value(right(Table_1[Year],4))
Then a measure that calculates a three year moving average
m3YrAvg =
CALCULATE(
AVERAGEX(
SUMMARIZE('Table_1','Table_1'[Year4],"Tot_AY_Ct", CALCULATE(COUNT('Table_1'[person_id])))
,[Tot_AY_Ct]),
FILTER(ALL('Table_1'[Year4]),
'Table_1'[Year4] <= MAX('Table_1'[Year4]) &&
'Table_1'[Year4] > (MAX('Table_1'[Year4])-3)
)
)
This works fine, but I would like it to work for only Group A. I can use the filter pane, but it seems cumbersome on some visuals and I would rather it be filtered at the calculation. I've tried adding it in the FILTER statement, but can't get it to work without error. Haven't used DAX much, so just can't seem to come up with the right placement or syntax I guess.
Any suggestion is appreciated.
@Jrose , Try with help from two measures
Avg1= AVERAGEX( values('Table_1'[Year4]), CALCULATE(COUNT('Table_1'[person_id])))
m3YrAvg =calculate([Avg1],
FILTER(ALL('Table_1'[Year4]),
'Table_1'[Year4] <= MAX('Table_1'[Year4]) &&
'Table_1'[Year4] > (MAX('Table_1'[Year4])-3) && 'Table_1'[group] = MAX('Table_1'[group])
) )
Thanks for the suggestion. Unfortunately, it's not working.
The first calculation for average is giving numbers way too low and I can't tell what it is trying to average across.
I tried the second calculation anyway, and it won't recognize the table columns. The list that pops up as I enter the table name only shows the calculated fields and measures. I typed it anyway and get an error that says "A single value for column "group" cannot be determined. I used MAX to see if it would at least clear the error, which it didn't, but it doesn't make sense in this context anyway I need to be able to say something like
where group = "A".
The original calculation I have works, I would just like to be able to add what is in the filter pane to the calculation instead as I anticipate needing it for other metrics in the future.
I guess I'm not understanding why it insists on an aggregate rather than being able to filter (select) only records of a certain value. And why in this calculation it doesn't want to recognize regular data columns.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 9 | |
| 6 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 21 | |
| 12 | |
| 9 | |
| 5 | |
| 5 |