Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
brentb
Regular Visitor

SUMX RELATEDTABLE combination not working

Hi,

 

I have two sets of formulas set up the same way, but one is not working and I cannot figure out why. In fact table SalesValueEntry I have two formulas:

SalesAmount = 

SUM ( 'factSalesValueEntry'[SalesAmount_RCY] )

 

SalesAmountN-1 = 

CALCULATE ( SUM ( 'factSalesValueEntry'[SalesAmount_RCY] ), DATEADD ( 'Date'[Date], -1, YEAR ) )

 

 There are both working and validated. In the customer table I have to measures related to the ones aboves:

 

CustomerTurnover = 

SUMX ( RELATEDTABLE ( 'factSalesValueEntry' ), [SalesAmount_SVE] )

 This one is working

 

 CustomerTurnoverN-1=

SUMX ( RELATEDTABLE ( 'factSalesValueEntry' ), [SalesAmountN-1_SVE] )

 

 This one is not and I have no clue why. It doesn't give me an error but just returns blank values. The setup looks a bit sketchy anyways on first sight, but I need this for a calculated colum in the customer table:

 

SWITCH ( TRUE (), [CustomerTurnover] > 0 && [CustomerTurnoverN-1] > 0, "ACTIVE", [CustomerTurnoverN-1] > 0 && [CustomerTurnover] <= 0, "LOST", [CustomerTurnoverN-1] <= 0 && [CustomerTurnover] > 0, "NEW", "N/A" )

 

3 REPLIES 3
Manoj_Nair
Solution Supplier
Solution Supplier

@brentb- Check this out and let me know if this works. Try modifying the CustomerTurnoverN-1 measure to use an explicit filter on the date table

CustomerTurnoverN-1=
CALCULATE(
    SUMX(RELATEDTABLE('factSalesValueEntry'), [SalesAmount_SVE]),
    FILTER(
        ALL('Date'),
        'Date'[Date] IN DATEADD('Date'[Date], -1, YEAR)
    )
)

I've hypothetically established this DAX measure, but without much clarity regarding your datasets. If this doesn't serve your needs, I recommend you share a sample dataset. This will give me a more comprehensive understanding of your data structure, enabling me to devise a more suitable solution. Cheers

Thank you for pointing me in the right direction. This worked eventually:

CALCULATE(
    SUMX(RELATEDTABLE('factSalesValueEntry'), [SalesAmount_SVE]),
    DATEADD('Date'[Date], -1, YEAR)
)

@brentb- Glad the solution worked for you. Could you please mark this as a solution and give it a thumbs up?

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors