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
MorganeLachuer
New Member

Problem with a calculation

Hi,

 

I have a problem in one of my calculation.

 

I have 2 tables connected to Power BI. One table contains my clients with their billing mode (table 1) and the other table (table 2) contains the transaction of each client.

 

Depending of the billing mode, I need to add several columns in table 2. For exemple, if the billing mode is Bundle, I have to add Interchange amount and volume amount. If the billing mode is IC, i have to add interchange and CSF amount.

 

For the moment, I created this calculation:

SWITCH(TRUE();accountBillingData[mode]="Bundle";SUM(transactionFees[InterchangeAmount]+SUM(transactionsFees[VolumeAmount]))

 

But the amount is not correct. I think Power BI recovers the total sum of interchange and volume and multiplies the result by the number of customers.

 

Do you have any idea what's wrong?

 

Best Regards;

 

Morgane

 

1 ACCEPTED SOLUTION
v-xuding-msft
Community Support
Community Support

Hi @MorganeLachuer ,

By my test, you need to add a ALL function in the measure. the following is my sample you can have a try.

 

I have two tables. And there is a one-to-one relationship based on the column of id between them.

Capture.PNG

Measure =

SWITCH (

    TRUE (),

    MAX ( Table1[BlingMode] ) = "Bundle", SUMX ( Table2, Table2[InterchangeAmount] + Table2[VolumeAmount] ),

    MAX ( Table1[BlingMode] ) = "IC", SUMX ( Table2, Table2[CSF Amount] + Table2[InterchangeAmount] )

)

0.jpg

If the result is not what you want, please post your sample data and the expected output.

 

Best Regards,

Xue Ding

 

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

 

Best Regards,
Xue Ding
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

1 REPLY 1
v-xuding-msft
Community Support
Community Support

Hi @MorganeLachuer ,

By my test, you need to add a ALL function in the measure. the following is my sample you can have a try.

 

I have two tables. And there is a one-to-one relationship based on the column of id between them.

Capture.PNG

Measure =

SWITCH (

    TRUE (),

    MAX ( Table1[BlingMode] ) = "Bundle", SUMX ( Table2, Table2[InterchangeAmount] + Table2[VolumeAmount] ),

    MAX ( Table1[BlingMode] ) = "IC", SUMX ( Table2, Table2[CSF Amount] + Table2[InterchangeAmount] )

)

0.jpg

If the result is not what you want, please post your sample data and the expected output.

 

Best Regards,

Xue Ding

 

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

 

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

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.