Forum Discussion

mmills2018's avatar
mmills2018
Helper IV
5 years ago
Solved

ISINTOTAL not working

Hello,

 

I have a hierarchy based on Platform and Group.  Group is the lowest level of the hierarchy.  I need to bring in static data for my goals, when i bring this data in, my matrix table is adding the subtotals.  So, my subtotals are at the platform level.  I tried using ISINSCOPE to customize my subtotals, but for some reason i can't get it to work.  below is my measure and data.  any ideas what i am doing wrong?

 

measure:

var _group = ISINSCOPE(Sheet1[Group])
var _groupsum = sum(Sheet1[Goal])
var platform = ISINSCOPE(Sheet1[Platform])
var platformsum = CALCULATE(sum(Sheet1[Goal]),Sheet1[IsPlatform]=1)
return
SWITCH(TRUE(),_group,_groupsum,platform,platformsum)

 

Data:

 

PlatformGroupGoalMgmt LevelsIsPlatform
Platform 1 1.1Group Total1
Platform 1 2.1Total PME1
Platform 1 3.1M4+1
Platform 1 4.1M1-M31
Platform 1 5.1P1-P61
Platform 1 6.1O1-O41
Platform 1 7.1B1-B41
Platform 1 8.1T1-T41
Platform 1Group 18.1Group Total0
Platform 1Group 18.1Total PME0
Platform 1Group 18.1M4+0
Platform 1Group 18.1M1-M30
Platform 1Group 18.1P1-P60
Platform 1Group 18.1O1-O40
Platform 1Group 18.1B1-B40
Platform 1Group 18.1T1-T40
Platform 1Group 20.1Total PME0
Platform 1Group 22.1M4+0
Platform 1Group 23.1M1-M30
Platform 1Group 24.1P1-P60
Platform 1Group 25.1O1-O40
Platform 1Group 26.1B1-B40
Platform 1Group 27.1T1-T40
Platform 2 8.1Total PME1
Platform 2 10.1M4+1
Platform 2 11.1M1-M31
Platform 2 12.1P1-P61
Platform 2 13.1O1-O41
Platform 2 14.1B1-B41
Platform 2 15.1T1-T41
Platform 2Group 38.1Total PME0
Platform 2Group 310.1M4+0
Platform 2Group 311.1M1-M30
Platform 2Group 312.1P1-P60
Platform 2Group 313.1O1-O40
Platform 2Group 314.1B1-B40
Platform 2Group 315.1T1-T40
  • Hi mmills2018 ,

     

    What is the expected result for this calculation how is the sub-totals expected to be calculated.

     

    Lookking at your data you need to pick up all the value for the platform, since you are using the inscope for both the values believe that the error you are getting in on the total line correct that is not returning any value for this you can simple use the measure below:

     

    measure = var _group = ISINSCOPE(Sheet1[Group])
    var _groupsum = sum(Sheet1[Goal])
    var platform = ISINSCOPE(Sheet1[Platform])
    var platformsum = CALCULATE(sum(Sheet1[Goal]),Sheet1[IsPlatform]=1)
    return
    SWITCH(TRUE(),_group,_groupsum,platformsum)

     

     

     

    However I have some doubts about your syntax since when making the hierarchy like you have you get a value with blanks(line highlithed) so when you filter that out your calculation get's incorrect you can remake you measure to:

    oupsum = sum(Sheet1[Goal])
    var platform = ISINSCOPE(Sheet1[Platform])
    var platformsum = CALCULATE(sum(Sheet1[Goal]),FILTER(ALL(sheet1),Sheet1[IsPlatform]=1 && sheet1[Platform] in VALUES(sheet1[Platform])))
    return
    SWITCH(TRUE(),_group,_groupsum,platformsum)

     

    This will allow to filter out the blanks and get the correct resutls:

    Another option can go to having dimension tables for the platforms and groups with the objectives on those tables but that implies big changes in your model.

     

    Check PBIX file attach.

1 Reply

  • Hi mmills2018 ,

     

    What is the expected result for this calculation how is the sub-totals expected to be calculated.

     

    Lookking at your data you need to pick up all the value for the platform, since you are using the inscope for both the values believe that the error you are getting in on the total line correct that is not returning any value for this you can simple use the measure below:

     

    measure = var _group = ISINSCOPE(Sheet1[Group])
    var _groupsum = sum(Sheet1[Goal])
    var platform = ISINSCOPE(Sheet1[Platform])
    var platformsum = CALCULATE(sum(Sheet1[Goal]),Sheet1[IsPlatform]=1)
    return
    SWITCH(TRUE(),_group,_groupsum,platformsum)

     

     

     

    However I have some doubts about your syntax since when making the hierarchy like you have you get a value with blanks(line highlithed) so when you filter that out your calculation get's incorrect you can remake you measure to:

    oupsum = sum(Sheet1[Goal])
    var platform = ISINSCOPE(Sheet1[Platform])
    var platformsum = CALCULATE(sum(Sheet1[Goal]),FILTER(ALL(sheet1),Sheet1[IsPlatform]=1 && sheet1[Platform] in VALUES(sheet1[Platform])))
    return
    SWITCH(TRUE(),_group,_groupsum,platformsum)

     

    This will allow to filter out the blanks and get the correct resutls:

    Another option can go to having dimension tables for the platforms and groups with the objectives on those tables but that implies big changes in your model.

     

    Check PBIX file attach.