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
AnaCBaumgratz11
Frequent Visitor

Distinct values based another column with duplicated rows

 

I have a table of expenses by customer and prefunding received bye each one.

 

Then, I need to calculate % received by each customer and the average by country.

 

However, the table has a row by ID, but Proforma column is by expense (then I have the same ID for several costs), and the PrefundingRec column repet the value for each row (only one prefunding received for each customer); and each ID service can have more than one customer.

 

I concatenated ID with Customer to have a unique Index (ID_Customer) and a Total Proforma (sum [Proforma]). However when I try divide PrefundingRec by Total Proforma, the result still multiply for the total row. I also tried to create a new table with ID, Customer and PrefundingRec; but I still cannot do the average calculation by country.

 

Capture.JPG

 

I'm new on Power BI, then I'm not sure how to solve this.

 

I appreciate if someone can help me.

 

Regards,

Ana

 

2 REPLIES 2
v-yulgu-msft
Employee
Employee

Hi @AnaCBaumgratz11,

 

Based on my understanding, I generated below calculated column.

divide =
CALCULATE (
    AVERAGE ( Test_1[PrefundingRec] ),
    ALLEXCEPT ( Test_1, Test_1[ID], Test_1[Customer] )
)
    / CALCULATE (
        SUM ( Test_1[Proforma] ),
        ALLEXCEPT ( Test_1, Test_1[ID], Test_1[Customer] )
    )

1.PNG

 


 Then, I need to calculate % received by each customer and the average by country. 

 


Please illustrate your desired output with examples and images.

 

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.

Hi @v-yulgu-msft

 

Thank your for your message.

 

I tried your suggestion, but it didn't work.

Please, see below my question with more details.

 

 I have the table below, where I have different services/sales (ID) by customer (Customer Name). Each ID means an attendance, which can be for more than one customer and related with one or more services type (Customer Cost Allocation). Then, I have a Proforma (costs paid, each row is one cost) and a Prefunding received (this is the total by ID, Customer Name and Customer Cost Allocation). The point is that the Prefunding is repeated in each row, when this is different for the same "ID, Customer Name and Customer Cost Allocation", it's because we received more than one remittance, and then I need to sum the values only if these are different.

 

 Table.JPG

 

Then I want to measure, difference of Prefunding to Proforma, value, as per field "Var." below, which would be sum of prefunding (only with different values) by each ID and Customer; and percentage, as per "Var. Perc." field below, which is sum of prefunding (only with different values) divided by sum of proforma (all values). See the results below.

 

Result1.JPG

 

Below is the result I expected to get for the average of % of Prefunding received by country.

 

Result2.JPG

 

Thanks in advance for your kind help.

 

Regards,

Ana B

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.