Forum Discussion

sixtoquiles's avatar
sixtoquiles
Helper II
9 years ago
Solved

Total from distinct values

HI, i need some advise:

 

I have this query: district, region, target

 

query1

Then apply a slicer and choose: Distric=north, and region=1, give me target 10,13.

 

 

filter values.

 

i want a measure give a total = 23 if a change my slice this total change too.

 

 

 

  • Hi sixtoquiles

     

    Try creating a measure over Target to be something like this

     

    Sum of Target = CALCULATE(SUM('Table'[target]'))

    From the data and description you have provided, this will result in a value of 23 once the filters on district and region have been set.

  • Well its simple you just have to create a measure and power bi will do the rest of it.

    Please follow the steps

    1. On the Dataset Right click and choose New Measure.

    2. TotalTarget=SUM(<DatasetName>[Target])

    Now this measure will be the total sum of the target value now all you have to do is just drag and drop it into the table

    the table will group District and Region and show the TotalTarget with respect to it.

    3. Drag and drop a table

    4. In Field Choose District, Region and TotalTarget

    5. Drop a Slicer and in field choose District, Region

  • kaushikd's avatar
    kaushikd
    9 years ago

    Hi Phil_Seamark

    i believe SUM('Table'[target]) will be sufficient.

    is there any need of CALCULATE ???

4 Replies

  • Phil_Seamark's avatar
    Phil_Seamark
    Microsoft Employee

    Hi sixtoquiles

     

    Try creating a measure over Target to be something like this

     

    Sum of Target = CALCULATE(SUM('Table'[target]'))

    From the data and description you have provided, this will result in a value of 23 once the filters on district and region have been set.

    • kaushikd's avatar
      kaushikd
      Resolver II

      Hi Phil_Seamark

      i believe SUM('Table'[target]) will be sufficient.

      is there any need of CALCULATE ???

      • Phil_Seamark's avatar
        Phil_Seamark
        Microsoft Employee

        Hi kaushikd,

         

        You don't need the CALCULATE but it is a good habit to get into for when your DAX becomes more sophisticated.

  • Well its simple you just have to create a measure and power bi will do the rest of it.

    Please follow the steps

    1. On the Dataset Right click and choose New Measure.

    2. TotalTarget=SUM(<DatasetName>[Target])

    Now this measure will be the total sum of the target value now all you have to do is just drag and drop it into the table

    the table will group District and Region and show the TotalTarget with respect to it.

    3. Drag and drop a table

    4. In Field Choose District, Region and TotalTarget

    5. Drop a Slicer and in field choose District, Region