Forum Discussion
Create a measure with a filter
- 7 years ago
Hi jdballard30,
You also can use a measure instead. There could be two approaches.
Measure = AVERAGEX ( DISTINCT ( SELECTCOLUMNS ( ProgramTransactions, "Col1", [AppId], "Col2", [DaysBetweenEvents] ) ), [Col2] )Measure 2 = AVERAGEX ( SUMMARIZE ( 'ProgramTransactions', 'ProgramTransactions'[AppId], 'ProgramTransactions'[DaysBetweenEvents] ), [DaysBetweenEvents] )Best Regards,
Dale
I think you need to get the distinct appid, daysbetweenevents rows of your table . Something like
NewTable = DISTINCT(SELECTCOLUMNS(YourTable, "ID", YourTable[AppId], "Days",YourTable[AverageDays]))
and then create a measure that takes the average of the Days column
NewMeasure = AVERAGE(NewTable[Days])
and stick that measure on a card
- jdballard307 years agoHelper II
I'm a bit confused, and it's me, not you. :smileyhappy:
Would the new table be created using the query editor or DAX?
- jdballard307 years agoHelper II
So I figured it out.
I used the "New Table" option on the Modeling menu to add the table. So that obviously creates a table, and I see how the distinct columns works. In my linked .pbix, I got the result I wanted.
I guess my question is: I could do this in my queries when everything is loaded. Is there a reason to do it in the front-end as opposed to the back-end or vice versa?
- HotChilli7 years agoCommunity Champion
It's entirely up to you. You can do the same algorithm in power query editor or advanced query editor using M.
If you have better skills in DAX, then use that.