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
ateetkoomar
Regular Visitor

Related Table

I have three tables.

  1. FactTable

    Dim_Time_Days_Sales (yyyymmdd)

    Dim_Time_Days_Refund (yyyymmdd)

    Sales £

    Refund £

 

2. Dim_Time_Days_Sales

   Date (yyyymmdd)

 

3. Dim_Time_Days_Refund

   Date (yyyymmdd)

 

I want to be able to work out the value of Sales after deducting Refund.

 

So a customer might buy something on 1st Nov and return on 5th of Nov. But I want to be able to say what was the sales amount after deducting refund. But as they are both occurring on different dates, how would I do that?

1 ACCEPTED SOLUTION

I have managed to sort this out. I created a fourth calendar and linked them through that.

View solution in original post

5 REPLIES 5
v-juanli-msft
Community Support
Community Support

Hi @ateetkoomar

How would you like the to calculate " the sales amount after deducting refund"?

Could you give an example?

 

I make a test, could you correct me if i understand you right?

create a measure

sales amount = SUM(FactTable[Sales])-SUM(FactTable[Refund])

4.png

 

Best Regards

Maggie

the table you have done is exactly what I need.

I have managed to sort this out. I created a fourth calendar and linked them through that.

So basically, I want to work out the sales amount for the 1st after deducting the refund which happened on the 5th from my original example.

AkhilAshok
Solution Sage
Solution Sage

Try creating a single Date table and add relationships to the 2 Date columns in your fact table. Keep the Sales Date relation active, and other inactive. Below code should give you the net Sales amount for a selected time frame.

 

Net Sales Amount =
SUM ( FactTable[Sales] )
    - CALCULATE (
        SUM ( FactTable[Refund] ),
        USERELATIONSHIP ( FactTable[Dim_Time_Days_Refund], Date[Date] )
    )

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.