Forum Discussion

DECRE83's avatar
DECRE83
Regular Visitor
1 year ago
Solved

sum measure from different cards

Hello,   So I have a page where I need to add certain steps on a transportation route. Each step of the route has a cost. At the end, I need a measure that sums the total of the individual steps, t...
  • v-karpurapud's avatar
    1 year ago

    Hi  DECRE83 
    Welcome to the Microsoft Fabric Forum,

     

    Regarding the measure to sum only the selected steps for the transportation route:

     

    Since all step costs are stored in a single table, and the requirement is for the total to reflect only the steps selected through the slicers, a measure should be created that dynamically respects the current filter context.

     

    Use SUMX function :

    DAX:

    Total Selected Route Cost = 
    SUMX( VALUES(Table[StepID]), 
    CALCULATE(SUM(Table[StepCost])) )


    If steps are uniquely identified by multiple columns (category, location1,location2) adjust the measure:

    DAX:

    Total Selected Route Cost = 
    SUMX( 
    SUMMARIZE( Table, 
    Table[Category], 
    Table[Location1], 
    Table[Location2] ), 
    CALCULATE(SUM(Table[StepCost])) ) 

     

    If this information helps resolve your issue, kindly consider marking this response as the Accepted Solution, as it may assist other community members facing similar challenges.

     

    Thank you for being part of the Microsoft Fabric Community.