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
StephenGrant
Frequent Visitor

Show results for one particular product in all rows

Hello

I'm wondering if someone can help me with a problem I'm stuck on.  

If I start with a simplified example.  Imagine I've got a table like this

ProductColorSales
ARed100
ABlue250
AGreen375
BRed430
BBlue540
BGreen670
CRed710
CBlue835
CGreen915

 

I want to see the sales for product A no matter what product I'm looking at, so something like this:

ProductColorSalesRequest
ARed100100
ABlue250250
AGreen375375
BRed430100
BBlue540250
BGreen670375
CRed710100
CBlue835250
CGreen915375

I can get this to work with this measure:

Measure =

   Calculate(

      sum(fctTable[Sales]),

      All(fctTable[Product]),

      fctTable[Product]="A"

   )

Which gives exactly what I want; this: 

StephenGrant_0-1636281817367.png

 

Now in real life I have a table with 1.6 million rows and the following headers:

StephenGrant_1-1636282011951.png


Where stress is one of 7 values of which "BaseMortStress" is one.  The table is effectively 7 union'ed tables 
StressAmt are multiple decimal numbers (the 'facts' here)

Full/TMTP contains 2 values; either "Full" or "TMTP"

UniqueProd is 267 product names
ProjYear is a whole number from 0 to 80
AoC_Step is one of 12 values

Now, I thought I could just use this measure:

  BaseMortStress =
    CALCULATE(
    SUM(fctFinalTable[StressAmt]),
    ALL(fctFinalTable[Stress]),
    fctFinalTable[Stress]="BaseMortStress"
  )
And get the results for the "BaseMortStress" 
fctFinalTable[Stress] value for every value in fctFinalTable[Stress].  But this isn't the case, when it's not BaseMortStress I just get a blank.  Which isn't what I want.
StephenGrant_3-1636282733336.png

I want the numbers in that BaseMortStress column repeated in all other columns.

Can anyone help me with this?  It would be much appreciated.

 

Thanks,

Stephen



 

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@StephenGrant 

You use it this way:

 BaseMortStress =
    CALCULATE(
     SUM(fctFinalTable[StressAmt]),
     fctFinalTable[Stress]="BaseMortStress"
  )
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

1 REPLY 1
Fowmy
Super User
Super User

@StephenGrant 

You use it this way:

 BaseMortStress =
    CALCULATE(
     SUM(fctFinalTable[StressAmt]),
     fctFinalTable[Stress]="BaseMortStress"
  )
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

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

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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