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
mbertalan
New Member

Subset table

I have a table

 

Table: Sales

Fruits; Year; Euros

Apple; 2020; 5000

Apple; 2021; 6000

Grape;2020; 1000

Grape; 2021; 2000

 

How can I select the value of Euros for Grape in 2021? 

 

I am creating a new measure which I would like to use part of the information from my table. 

 

Should I use Selectvalues, values or filter? 

 

 

1 ACCEPTED SOLUTION
v-binbinyu-msft
Community Support
Community Support

Hi @mbertalan ,

 

Please try to create a measure like below and you can choose to use filter function or not :

Measure with filter function:

Measure1 =
CALCULATE (
    MAX ( Sales[Euros] ),
    FILTER ( ALL ( Sales ), Sales[Fruits] = "Grape" && Sales[Year] = 2021 )
)

vbinbinyumsft_0-1658135334631.png

 


Measure without filter function:

Measure2 =
CALCULATE (
    MAX ( Sales[Euros] ),
    Sales[Fruits] = "Grape",
    Sales[Year] = 2021,
    ALL ( Sales )
)

vbinbinyumsft_1-1658135397757.png

 

If I misunderstand your demands, please feel free to let me know.

Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-binbinyu-msft
Community Support
Community Support

Hi @mbertalan ,

 

Please try to create a measure like below and you can choose to use filter function or not :

Measure with filter function:

Measure1 =
CALCULATE (
    MAX ( Sales[Euros] ),
    FILTER ( ALL ( Sales ), Sales[Fruits] = "Grape" && Sales[Year] = 2021 )
)

vbinbinyumsft_0-1658135334631.png

 


Measure without filter function:

Measure2 =
CALCULATE (
    MAX ( Sales[Euros] ),
    Sales[Fruits] = "Grape",
    Sales[Year] = 2021,
    ALL ( Sales )
)

vbinbinyumsft_1-1658135397757.png

 

If I misunderstand your demands, please feel free to let me know.

Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

daXtreme
Solution Sage
Solution Sage

[what you want] =
calculate(
  selectedvalue( Sales[Euros] ),

  // keepfilters is here to honor
  // any already existing filters
  // on the table
  keepfilters( Sales[Fruit] = "Grape" ),
  keepfilters( Sales[Year] = 2021 ),

  // use all( Sales ) if you want to
  // remove all exising filters on Sales;
  // if you want to keep them, then remove
  // this line
  all( Sales )
)
Jihwan_Kim
Super User
Super User

Hi,

Please try something like below.

 

Euros only for grape 2021 measure: =
CALCULATE (
    SUM ( 'Sales'[Euros] ),
    FILTER ( ALL ( 'Sales' ), 'Sales'[Fruits] = "Grape" && 'Sales'[Year] = 2021 )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

March 2024 PBI Gallery Image

Power BI Monthly Update - March 2024

Check out the March 2024 Power BI update to learn about new features.

Top Solution Authors