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

Need help No delivered sales amount (Per transaction Sales data great than Delivered)

Table T1 is Sales data, and Table T2 is Delivered data, both are Fact table.

  1. Table T1 and T2 join with ID,
  2. Many to Many relationship
  3. Want to show the total sales amount of no delivered product by date.
  4. The most hard part is:  I need add a filter to the ID which is sales amount is greater than Delivered amount.
 

 

1 ACCEPTED SOLUTION

Hi @Anonymous 

 

I modified the measure as below to calculate the cumulative amounts of undelivered sales: (Other measures kept unchanged)

TotalsalesofNoDiliveryDate = SUMX(FILTER(ALL('Table'),[Tran_Date]<=MAX('Table'[Tran_Date])),[Measure])

2.PNG

 

pbix attached.

Community Support Team _ Dina Ye
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

6 REPLIES 6
v-diye-msft
Community Support
Community Support

Hi @Anonymous 

 

Let me know if you'd like to get below results:

Measure for total sales amount of no delivered product:

Measure = IF(CALCULATE(MAX('Table (2)'[Deliv_Date]),FILTER('Table',[ID]=MAX('Table (2)'[ID])))<>BLANK(),0,MAX('Table'[Sales_Amt]))

TotalsalesofNoDiliveryDate = SUMX('Table',[Measure])

Calculated column for the ID slicer:

IDLIST = IF([Sales_Amt]>MAXX(RELATEDTABLE('Table (2)'),[Sales Amt]),[ID])

I used you sample but added 1 row with ID 123 to make it easier to find the clarification:

 

0001.PNG

PBIX attached.

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

@v-diye-msft Hi Diye, May I get your insight based on my reply? thanks a million.

Hi @Anonymous 

 

I modified the measure as below to calculate the cumulative amounts of undelivered sales: (Other measures kept unchanged)

TotalsalesofNoDiliveryDate = SUMX(FILTER(ALL('Table'),[Tran_Date]<=MAX('Table'[Tran_Date])),[Measure])

2.PNG

 

pbix attached.

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

@v-diye-msft @Anonymous  Really apprecaite your response and support,

 

1, This is a many to many relationship, in the Table1, for 1 ID, there are multiple rows.

2, I 'd like to get the cumulative sales amount undelivered,

3, This is kind of like a inventory data, I have incoming data and outcoming data as the time, I 'd like to get the cumulative amount what I have,  but for every ID, It should have the sales amount is great than the delivery amount.

4, I'd like to show the cumulative amount by date.

 

5, May you please guide me load a PBIX file ?

Anonymous
Not applicable

Hi @Anonymous ,

Please post sample data in text format ( i.e: Copy & Pasteable format).

 

That will make it easier to help you.

 

Cheers,

Rob

Anonymous
Not applicable

@Anonymous Appreciate for your response

I need to get the cumulative Open sales amount:

Table T1 Format is as:

IDTran_DateSales_Amt
12285319_158/2/201971.2
11755054_738/2/2019158
12336199_148/12/2019157.43
12445312_148/31/2019157.38
2000493738_1008/31/2019-598
12308184_128/10/2019-193.29
12203847_108/3/2019-449
11981361_348/30/2019157.38
12326067_148/10/2019157.38
12263246_508/31/2019-598
2000511216_2048/9/2019157.43
12324887_208/10/2019158
12302713_348/5/2019157.38
12325910_208/16/2019-449
12346522_208/15/2019-449

 Table T2:

IDDeliv_DateSales Amt
2000516244_1018/23/2019109
2000516244_1028/23/2019200
2000516244_1038/23/2019130
2000516244_1048/23/2019160
2000516434_1008/27/2019399
2000516434_2008/27/2019499
2000516640_1008/28/2019299
2000516275_3018/30/2019215
2000516275_1028/25/2019332.97
2000516275_2008/25/201960

Here is the SQL:

SELECT SUM(COALESCE(w.[Sales Amt], 0) - COALESCE(d.[Deliv Amt], 0)) Open_Sales
FROM
(select ID, COALESCE(sum([Sales_amt]), 0) [Sales Amt]
from Write_sales 
where [Tran_Date] < @Datefilter 
group by ID ) W
left join
(select ID, COALESCE(sum([Deliv_Amt]), 0) [Deliv Amt]
from Deliv_sales 
where deliv_date < @Datefilter 
group by id) D
on d.ID = w.ID
WHERE w.[Sales Amt] > COALESCE(d. [Deliv Amt], 0)

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.