Forum Discussion
Assistance needed on DistinctCount and Group By
- 6 years ago
Well this is a neat trick I picked up this week, I think it was mwegener who posted it as a response somewhere. The problem is that your expression is evaluated given the filters it operates in. In your case, it evaluates the distinctcount regardless of sessionID in the total row.
Create a measure that creates a temporarily table and sum the column that reflects the distinctcounts like this:
Measure = SUMX(SUMMARIZE(Table4, Table4[Session], "@count", DISTINCTCOUNT(Table4[URL])), [@count])This results in this table:
This measure is evaluates three times (once per session and also again for the total. However, the context of the first row is the Table4 filtered on Session=ceqr. In the Total row, the context is not filtered on sessionID and thus, the distinctcounts of the temporary table is summed.
Let me know if this works! 🙂
Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Keep those thumbs up coming! 🙂
Well this is a neat trick I picked up this week, I think it was mwegener who posted it as a response somewhere. The problem is that your expression is evaluated given the filters it operates in. In your case, it evaluates the distinctcount regardless of sessionID in the total row.
Create a measure that creates a temporarily table and sum the column that reflects the distinctcounts like this:
Measure = SUMX(SUMMARIZE(Table4, Table4[Session], "@count", DISTINCTCOUNT(Table4[URL])), [@count])This results in this table:
This measure is evaluates three times (once per session and also again for the total. However, the context of the first row is the Table4 filtered on Session=ceqr. In the Total row, the context is not filtered on sessionID and thus, the distinctcounts of the temporary table is summed.
Let me know if this works! 🙂
Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Keep those thumbs up coming! 🙂