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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Sum of values basis distinct value from another column

Hi ,

 

I want to create a measure which will give me value of a ID basis distinct.

 

My table is like: 

 

OppIDValue
1P15
1P25
1P35
2P110
2P210
3P120
4P115
5P115
5P215
5P315
6P120
6P220
7P110
8P116
8P216
9P120
9P220
10P125
10P225
10P3

25

 

Output Should be
OppidValue
1P15
2P110
3P120
4P115
5P115
6P120
7P110
8P116
9P120
10P125
1 ACCEPTED SOLUTION

Hi @Anonymous,

 

Please try:

Gross MRC@95 =
SUMX (
    SUMMARIZE (
        FILTER (
            Table_RS,
            Table_RS[MRC Status] = "Gross MRC"
                && ( Table_RS[Probability (%)] = 95 )
        ),
        Table_RS[Opportunity ID],
        "RS MRC($K)2", AVERAGE ( Table_RS[RS MRC($K)] )
    ),
    [RS MRC($K)2]
)

Gross MRC@100 =
SUMX (
    SUMMARIZE (
        FILTER (
            Table_RS,
            Table_RS[MRC Status] = "Gross MRC"
                && ( Table_RS[Probability (%)] = 100 )
        ),
        Table_RS[Opportunity ID],
        "RS MRC($K)2", AVERAGE ( Table_RS[RS MRC($K)] )
    ),
    [RS MRC($K)2]
)

Total Gross = [Gross MRC@95]+[Gross MRC@100]

1.PNG

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
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

10 REPLIES 10
TomMartens
Super User
Super User

Hey,

 

not sure if I understand you correctly, but by looking at your table and your desired output, just do the following in Power BI Desktop.

 

Create a Slicer visual and add the ID column to its value field

 

Create a Table visual and add the columns to the table in the desired sequence to the values field of the table visual, open the context menu of the Opp column and switch the aggregation to: "Don't summarize"

2017-09-25_10-53-11.png

 

Hopefully this is what you are looking for.

 

Regards

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Anonymous
Not applicable

Thanks Tom for your Quick reply.

 

The output was just a reference. Actually i want sum of value in a table and those value should be calculated for distict ID only.

Total value P1156
Total value P2111
  

Hi @Anonymous,

 

If in your result table, there are only two columns ID and Total Value, you can create a simple measure:

TotalValue = SUM(Sheet1[Value])

Then, add [ID] and this measure into table visual.

1.PNG

 

If you want to display [Opp], [ID] and total values in result table, you should create a measure like below:

TotalValue = CALCULATE(SUM(Sheet1[Value]),ALLEXCEPT(Sheet1,Sheet1[ID]))

2.PNG

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thanks Yuliana,

 

However i was able to create measure for my output which is 

Measure_Proba = SUMX(VALUES(Table_RS[Opportunity ID]),CALCULATE(AVERAGE(Table_RS[RS MRC($K)]))).

It gives me total value for unique ID but when i try to put condition/filter, it doesn't give me correct output rather doubling the total value.

 

Measure_Proba = SUMX(VALUES(Table_RS[Opportunity ID]),CALCULATE(AVERAGE(Table_RS[RS MRC($K)]), FILTER(Table_RS,Table_RS[MRC Status]="Gross MRC" && (Table_RS[Probability (%)]=95))))

 

Could u please help to make the correction in my query. Or is there any way to sortout this issue.

Hi @Anonymous,

 


Measure_Proba = SUMX(VALUES(Table_RS[Opportunity ID]),CALCULATE(AVERAGE(Table_RS[RS MRC($K)]), FILTER(Table_RS,Table_RS[MRC Status]="Gross MRC" && (Table_RS[Probability (%)]=95))))

 


 

Please provide more description about above measure. I cannot understand those table names and column names don't exist in sample data in your original post. Besides, to help me better understand your actual requirement, please post an image to show your desired output.

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi,

 

Below one is the actual table which i was refereing in my query.

Opportunity IDProbability (%)RS MRC($K)MRC Status
123100661.16Gross MRC
123100661.16Gross MRC
123495124.8Gross MRC
123495124.8Gross MRC
123495124.8Gross MRC
213100-410.53Neg MRC
213100-410.53Neg MRC
4321100-435.05Neg MRC
4321100-435.05Neg MRC
1234595450Gross MRC
1234595450Gross MRC
1234595450Gross MRC
265395-200Neg MRC
265395-200Neg MRC
265395-200Neg MRC
1551100287.06Gross MRC
1551100287.06Gross MRC
1551100287.06Gross MRC

 

And my output should be in a metrics or table like below

 

 Gross MRC@95Gross MRC@100Total Gross
Total Value :574.8948.221523.02

 When i put below query it doesn't give me above output for 1st measure

 

Measure_Proba = SUMX(VALUES(Table_RS[Opportunity ID]),CALCULATE(AVERAGE(Table_RS[RS MRC($K)]), FILTER(Table_RS,Table_RS[MRC Status]="Gross MRC" && (Table_RS[Probability (%)]=95))))

 

Hope this will help to understand my exact requirement.

Hi @Anonymous,

 

Please try:

Gross MRC@95 =
SUMX (
    SUMMARIZE (
        FILTER (
            Table_RS,
            Table_RS[MRC Status] = "Gross MRC"
                && ( Table_RS[Probability (%)] = 95 )
        ),
        Table_RS[Opportunity ID],
        "RS MRC($K)2", AVERAGE ( Table_RS[RS MRC($K)] )
    ),
    [RS MRC($K)2]
)

Gross MRC@100 =
SUMX (
    SUMMARIZE (
        FILTER (
            Table_RS,
            Table_RS[MRC Status] = "Gross MRC"
                && ( Table_RS[Probability (%)] = 100 )
        ),
        Table_RS[Opportunity ID],
        "RS MRC($K)2", AVERAGE ( Table_RS[RS MRC($K)] )
    ),
    [RS MRC($K)2]
)

Total Gross = [Gross MRC@95]+[Gross MRC@100]

1.PNG

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thanks Yuliana,

 

It worked for me.

Anonymous
Not applicable

Hi,

 

I want to calculate a measure which will give me Sum value for unique ID only basis certain criteria/filter.

My table is like:

 

OppIDValue
1P15
1P25
1P35
2P110
2P210
3P120
4P115
5P115
5P215
5P315
6P120
6P220
7P110
8P116
8P216
9P120
9P220
10P125
10P225
10P325

 

 Output Should be
OppidValue
1P15
2P110
3P120
4P115
5P115
6P120
7P110
8P116
9P120
10P125

You should be able to just create a table visualization and put Opp in it and set it to "Do not summarize". Then place ID and Value in it and filter ID to P1. Shouldn't need a measure or anything else.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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