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
fklatecki
Helper I
Helper I

Cross Table to Flat Table

Greetings,

 

Tables:

 

"rebates"

"sales"

 

Calculated columns:

 

Rebate 2016B = IF(sales[year]=2016, sales[Rebatable]*related('2016 Rebate'[Percent%]))

Adj 2016 Rebate = CALCULATE(SUMX(FILTER(RELATEDTABLE(rebates),rebates[year]=2016),rebates[sales])) (not summarized)

Total2016Rebate = CALCULATE(SUM(sales[Adj 2016 Rebate])+SUM(sales[Rebate 2016B])) (summarized)

 

In the table below, I have a calculated column, "Adj 2016 Rebate":

 

Our legacy system allows for manual entry of a rebate that is stored in seperate table "rebates" for each customer by source supplier.

 

To calculate actual rebatable, we must add manually entered rebate value (rebates[sales])  to (sales[Rebate 2016B]), hence Total2016Rebate.

 

i.e. for one supplier ( Rebate (autogenerated) = $0.00 Manually entered rebate $2937.49 = Total 2016 rebate $$ = $2937.49

49

 

In the "summarized" view of Total2016Rebate, I get an inflated value of 205,624.30 (70 x 2,9373.49) rather than the expected 2,937.49.

 

InkedPB_LI.jpg

 

When unsummarize, Total2016Rebate, I get this table, as you can see, I get a correctly calculated value, but I have the detail data burst.

 

Inkedunsummarized_LI.jpg

 

Any guidance from the DAX guru's would be greatly appreciated!

3 REPLIES 3
Eric_Zhang
Employee
Employee

@fklatecki

Try

Total2016Rebate =
CALCULATE ( MAX ( sales[Adj 2016 Rebate] ) + SUM ( sales[Rebate 2016B] ) )

If it is not your case, please post some sample data. Even better you can upload the pbix file to OneDrive or any web drive and share the download link. Do note to mask sensitive data before uploading.

Thank you for the response, however using MAX did not change the results. Per your advice here is link to a shared pbix file in DropBox.

 

 

 

https://www.dropbox.com/sh/9zjq96vphko356t/AABLGEqzmlleozv2g6yfIS9qa?dl=0

 

I very much appreciate comments and suggestions from the Power BI Community.

 

Regards.


@fklatecki wrote:

Thank you for the response, however using MAX did not change the results. Per your advice here is link to a shared pbix file in DropBox.

 

 

 

https://www.dropbox.com/sh/9zjq96vphko356t/AABLGEqzmlleozv2g6yfIS9qa?dl=0

 

I very much appreciate comments and suggestions from the Power BI Community.

 

Regards.


@fklatecki

Thanks for sharing the pbix file. Try

Total2016RebateM = CALCULATE(MAX(sales[Adj 2016 Rebate])+SUM(sales[Rebate 2016B])/100)

 

Capture.PNG

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.