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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Len30
Frequent Visitor

Measure to sum by unselected column

I’m having an issue creating a desired measure. I have a table in this format;

 

ProductYearCustomerAmount
AAA2023Bob10
AAA2023Bob10
AAA2023Sally50
AAA2024James50
AAA2024Jack80
BBB2023Bob20
BBB2024Bob20
BBB2024Bob20
BBB2024James20
CCC2023Sally10
CCC2023Sally20
CCC2024James30

 

In my draft dashboard, this table is summarised in a table visualisation. I want to create a measure that presents the smallest amount by the selected fields, and also by customer.

 

So the desired visualisation table would be;

 

ProductYearAmount sumSmallest amount by customer
AAA20237020
AAA202413050
BBB20232020
BBB20246020
CCC20233030
CCC20243030

 

Slicers exist for the product, year and customer fields. And the fields in the visualisation can be changed by the user. So as another example, if year is not selected, I’d want the visualisation to read;

 

ProductAmount sumSmallest amount by customer
AAA20020
BBB8020
CCC6030

 

Any help would be much appreciated.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Len30 ,

Below is my table:

vxiandatmsft_0-1709098184652.png

The following DAX might work for you:

 

 

column = 
  IF('Table'[Customer] = "Sally" && 'Table'[Product] = "CCC",
    CALCULATE(SUM('Table'[Amount]),FILTER('Table','Table'[Product] = "CCC") ,FILTER('Table','Table'[Customer] = "Sally")),CALCULATE(SUM('Table'[Amount])))


Measure = CALCULATE(
    MIN('Table'[column]),
     ALL(Parameter[Parameter]))


Amount Sum = CALCULATE(
      SUM('Table'[Amount]),
      ALL(Parameter[Parameter]))

 

 

Then create a Field parameter:

vxiandatmsft_1-1709098288457.png

The final output is shown in the following figure:

vxiandatmsft_4-1709098450899.pngvxiandatmsft_5-1709098459821.png

Best Regards,

Xianda Tang

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

2 REPLIES 2
Len30
Frequent Visitor

Thanks v-xiandat-msft. This produces the outcome I asked for, so I’ve marked it as the solution.

 

Unfortunately, I’ve realised my example doesn’t highlight one of the key issues. In the example data, calculating the table by product can be done by the minimum values of “Measure” in the table by product and year. In reality, I can’t make this assumption. If the value for BBB / 2024 / James was 100 rather than 20, this would show the issue – the values in the last table for BBB would then need to resolve as 160 and 60.

Anonymous
Not applicable

Hi @Len30 ,

Below is my table:

vxiandatmsft_0-1709098184652.png

The following DAX might work for you:

 

 

column = 
  IF('Table'[Customer] = "Sally" && 'Table'[Product] = "CCC",
    CALCULATE(SUM('Table'[Amount]),FILTER('Table','Table'[Product] = "CCC") ,FILTER('Table','Table'[Customer] = "Sally")),CALCULATE(SUM('Table'[Amount])))


Measure = CALCULATE(
    MIN('Table'[column]),
     ALL(Parameter[Parameter]))


Amount Sum = CALCULATE(
      SUM('Table'[Amount]),
      ALL(Parameter[Parameter]))

 

 

Then create a Field parameter:

vxiandatmsft_1-1709098288457.png

The final output is shown in the following figure:

vxiandatmsft_4-1709098450899.pngvxiandatmsft_5-1709098459821.png

Best Regards,

Xianda Tang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.