Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
rpinxt
Solution Sage
Solution Sage

A way to calculate / sum the unique values in a table

Consider this data sample :

 

UserLinesHoursUpH
Jan1472.170
Jan1472.170
Jan1472.170
Jan1472.170
Jan1472.170
Jan1472.170
Jan1472.170
Jan1472.170
Piet2002.677
Piet2002.677
Piet2002.677
Piet2002.677
Piet2002.677
Piet2002.677
Piet2002.677
Piet2002.677
Piet2002.677
    
Total3474.774

 

UpH is Lines / Hours

 

On a line level this is straight forward.

But on a total level it should only sum the unique values.

 

Summing unique values would also work on a line level because there is only 1 value.

 

But can it be done sum unique?

3 ACCEPTED SOLUTIONS
rajendraongole1
Super User
Super User

Hi @rpinxt - create a new measures for unique Lines and Hours as below:

 

UniqueLines =
SUMX(
    SUMMARIZE(
        'lhp',
        'lhp'[User],
        "UniqueLines", MAX('lhp'[Lines])
    ),
    [UniqueLines]
)

 

For New measure Hours:

UniqueHours =
SUMX(
    SUMMARIZE(
        'LHP',
        'LHP'[User],
        "UniqueHours", MAX('LHP'[Hours])
    ),
    [UniqueHours]
)

 

rajendraongole1_0-1722609497009.png

 

Now let's calculate another measure for the totalUpH based on the unique sums.

TotalUpH = DIVIDE([UniqueLines], [UniqueHours])

 

Hope it works





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

Note that this assumes only one unique set of values for each user.

 

If this is not the case, try summarizing over the appropriate level of granularity. For example, this groups over users and lines:

 

UniqueLines =
SUMX (
    SUMMARIZE (
        'lhp',
        'lhp'[User],
        'lhp'[Lines]
    ),
    'lhp'[Lines]
)

 

 

View solution in original post

rpinxt
Solution Sage
Solution Sage

Thanks for this @rajendraongole1 and @AlexisOlson I appreciate it.

 

However with the first method I did not get unique values per user :

rpinxt_0-1722850095105.png

So guessing it was because of what Alexis said, howver that method also did not give me unique lines per user.

rpinxt_1-1722850414373.png

181460 is the total number of rows in the dataset.

Used this code :

UniqueLines =
SUMX(
    SUMMARIZE(
        'Dom/Can q3/4',
        'Dom/Can q3/4'[User name],
        'Dom/Can q3/4'[Total lines]
    ),
    'Dom/Can q3/4'[Total lines]
)
 
I also was thinking if we want to make date part of the logic to get a unique number per dag with :
rpinxt_2-1722850568452.png

But this did not change anything.

View solution in original post

5 REPLIES 5
rpinxt
Solution Sage
Solution Sage

Thanks again @AlexisOlson and @rajendraongole1 

Your solutions work but not entirely how we had our data modeled.

We made changes now and found a solutions.

Thanks for your help.

rpinxt
Solution Sage
Solution Sage

Thanks for this @rajendraongole1 and @AlexisOlson I appreciate it.

 

However with the first method I did not get unique values per user :

rpinxt_0-1722850095105.png

So guessing it was because of what Alexis said, howver that method also did not give me unique lines per user.

rpinxt_1-1722850414373.png

181460 is the total number of rows in the dataset.

Used this code :

UniqueLines =
SUMX(
    SUMMARIZE(
        'Dom/Can q3/4',
        'Dom/Can q3/4'[User name],
        'Dom/Can q3/4'[Total lines]
    ),
    'Dom/Can q3/4'[Total lines]
)
 
I also was thinking if we want to make date part of the logic to get a unique number per dag with :
rpinxt_2-1722850568452.png

But this did not change anything.

Those results look odd for sure. Is the [User name] column in your table visual coming from a different data table?

rajendraongole1
Super User
Super User

Hi @rpinxt - create a new measures for unique Lines and Hours as below:

 

UniqueLines =
SUMX(
    SUMMARIZE(
        'lhp',
        'lhp'[User],
        "UniqueLines", MAX('lhp'[Lines])
    ),
    [UniqueLines]
)

 

For New measure Hours:

UniqueHours =
SUMX(
    SUMMARIZE(
        'LHP',
        'LHP'[User],
        "UniqueHours", MAX('LHP'[Hours])
    ),
    [UniqueHours]
)

 

rajendraongole1_0-1722609497009.png

 

Now let's calculate another measure for the totalUpH based on the unique sums.

TotalUpH = DIVIDE([UniqueLines], [UniqueHours])

 

Hope it works





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Note that this assumes only one unique set of values for each user.

 

If this is not the case, try summarizing over the appropriate level of granularity. For example, this groups over users and lines:

 

UniqueLines =
SUMX (
    SUMMARIZE (
        'lhp',
        'lhp'[User],
        'lhp'[Lines]
    ),
    'lhp'[Lines]
)

 

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.