Forum Discussion
afk
8 years agoAdvocate II
Sum unique values daily
Hi, I would like to sum the number of visits to a URL, based on unique URLs for each day. An example of the data is as follows. Date URL Product Visits 01/03/2018 www.url...
- 8 years ago
HI afk
Try this MEASURE
Measure = SUMX ( ALLSELECTED ( Table1[Date] ), CALCULATE ( FIRSTNONBLANK ( Table1[Visits], 1 ) ) ) - 8 years ago
To get figures with correct total...please create another MEASURE which will reference the first MEASURE i.e.
Measure 2 = IF ( HASONEFILTER ( Table1[URL] ), [Measure], SUMX ( ALLSELECTED ( Table1[URL] ), [Measure] ) )
Zubair_Muhammad
8 years agoCommunity Champion
It is a quite common situation to have a wrong Total for a MEASURE in rows and/ or columns
For example see Greg's post
https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/m-p/63376
So we use different formulas for individual rows/columns and total row/column
HASONEVALUE or HASONEFILTER functions help detect if a row is a TOTAL row or not.
We use SUMX to aggregate the measure (used for individual rows) over allrows of the table so that we can get the correct total in the Table Visual
afk
8 years agoAdvocate II