Forum Discussion
How to create a dax function that works both in table context and in the context of Total?
- 3 years ago
Please see this video for how to get your expected total.
(2) Power BI - Tales from the front #01 - Getting the Right Total - YouTube
In your case, you likely need something like
NewMeaure = SUMX(VALUES(Table[Date]), [Trials associated with events])
Pat
Hi Anonymous ,
You can use IF(HASONEVALUE(tablename[date]) to determine if the row is a normal row with a date or a total row. If it has one value it is a normal row, if it doesn't it is a total row.
https://mitchellpearson.com/2018/05/18/unexpected-totals-in-dax-part-1/
Hi djurecic . Thanks for teaching me about the HASONEVALUE function. I will keep that in the back pocket. On this ocassion it seems that what Pat suggested handles the context correctly by itself so I'll go with that as it's simpler.