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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
dinesharivalaga
Post Patron
Post Patron

Not able to get the result using DISTINCT to calculate the values

Hi Experts,

I am working on the scenario to calculate the total processes across all the unique accounts. but tried multiple ways of formula but nothing given an expected result.

 

below the table i am using (sample data) , processes type has many names and i am filtering only "No of processess in scope" values.
As per the below table , the total processes is 935 , but we have to sum each unique account values , in that case it should be 123 

 

No.of ProcessesProcesses TypeAccount Name
2No of Processes in ScopeAAAA
48No of Processes in ScopeBBB
48No of Processes in ScopeBBB
48No of Processes in ScopeBBB
48No of Processes in ScopeBBB
48No of Processes in ScopeBBB
48No of Processes in ScopeBBB
2No of Processes in ScopeCCCC
2No of Processes in ScopeCCCC
2No of Processes in ScopeCCCC
2No of Processes in ScopeCCCC
2No of Processes in ScopeCCCC
1No of Processes in ScopeDD
1No of Processes in ScopeDD
1No of Processes in ScopeDD
1No of Processes in ScopeDD
1No of Processes in ScopeDD
70No of Processes in ScopeSSS
70No of Processes in ScopeSSS
70No of Processes in ScopeSSS
70No of Processes in ScopeSSS
70No of Processes in ScopeSSS
70No of Processes in ScopeSSS
70No of Processes in ScopeSSS
70No of Processes in ScopeSSS
70No of Processes in ScopeSSS

 

I have used below DAX but it is still giving overall values only , please help to fix ..

SUMX(
DISTINCT('Test Delivery Updates (3)'[Account Name]),
CALCULATE(
SUM('Test Delivery Updates (3)'[No.of Processes]),
'Test Delivery Updates (3)'[Processes Type] = "No of Processes in Scope"
)
)

CALCULATE(SUMX(VALUES('Test Delivery Updates (3)'[No.of Processes]),CALCULATE(DISTINCT('Test Delivery Updates (3)'[No.of Processes]))),'Test Delivery Updates (3)'[Processes Type] = "No of Processes in Scope")
 
Thanks
DK



1 ACCEPTED SOLUTION

Hi @dinesharivalaga ,

 

ValtteriN‘s workaround is good.

You can just modify his measure as 

 

Measure = var _table=DISTINCT(SUMMARIZE(FILTER('Table',[Processes Type]="No of Processes in Scope"),'Table'[Account Name],'Table'[No.of Processes]))
return SUMX(_table,[No.of Processes])

 

Sample data:

vstephenmsft_1-1736755812500.png

Result:

vstephenmsft_0-1736755955035.png

You can download my attachment for more details.


Best Regards,
Stephen Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

View solution in original post

7 REPLIES 7
sanalytics
Super User
Super User

@dinesharivalaga 

You can refer below measure as well

VAR _tbl = 
SUMMARIZE(
    FILTER( 'Table', 'Table'[Processes Type] = "No of Processes in Scope" ),
    'Table'[Account Name]
)
VAR _tblCol = 
ADDCOLUMNS(
    _tbl,"@MaxProcess",CALCULATE( MAX( 'Table'[No.of Processes] ) )
)
VAR _Result = 
SUMX(
    _tblCol,[@MaxProcess]
)

RETURN
_Result

 

Below screenshot

sanalytics_0-1736506421079.png

 

Regards

sanalytics

Poojara_D12
Super User
Super User

Hi @dinesharivalaga 

To calculate the sum of processes for unique accounts, the formula uses:

 

SUMMARIZE: Groups data by Account Name and calculates the sum of No.of Processes for each account where Processes Type = "No of Processes in Scope."

SUMX: Sums up the results from the grouped data.

 

Total Processes for Unique Accounts =
SUMX(
    SUMMARIZE(
        'Test Delivery Updates (3)',
        'Test Delivery Updates (3)'[Account Name],
        "Unique Processes", SUMX(
            FILTER(
                'Test Delivery Updates (3)',
                'Test Delivery Updates (3)'[Processes Type] = "No of Processes in Scope"
            ),
            'Test Delivery Updates (3)'[No.of Processes]
        )
    ),
    [Unique Processes]
)

 

 

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Poojara
Data Analyst | MSBI Developer | Power BI Consultant
Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS 

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos"

Kind Regards,
Poojara - Proud to be a Super User
Data Analyst | MSBI Developer | Power BI Consultant
Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS

@Poojara_D12  This is still giving me total values (including duplicate account rows as well) 😞

ValtteriN
Super User
Super User

Hello, 

Try this:

Measure 31 = SUMX(SUMMARIZE('Table (47)','Table (47)'[No.of Processes],'Table (47)'[Account Name]),[No.of Processes])

Summarize groups values to uniques and then SUMX for sum.

ValtteriN_1-1736503103688.png

 

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





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

Proud to be a Super User!




@ValtteriN  Here we need to filter only 

[Processes Type] = "No of Processes in Scope"

 as per the sample data I have only posted "No of processes in scope" type but we should add it in the DAX as well .. 

Hi @dinesharivalaga ,

 

ValtteriN‘s workaround is good.

You can just modify his measure as 

 

Measure = var _table=DISTINCT(SUMMARIZE(FILTER('Table',[Processes Type]="No of Processes in Scope"),'Table'[Account Name],'Table'[No.of Processes]))
return SUMX(_table,[No.of Processes])

 

Sample data:

vstephenmsft_1-1736755812500.png

Result:

vstephenmsft_0-1736755955035.png

You can download my attachment for more details.


Best Regards,
Stephen Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

@v-stephen-msft 
Thanks for the solution and sample 🙂

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.