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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
rgtanna
New Member

Create conditional measure

Greetings, 

 

I'm trying to create a conditional measure that sums up all "stage 1" values only if "stage 3" has a value for the row item.

 

The data below is of sample source data, but when importing the data, I have unpivot the Stage 1 through to Stage 3 columns.

 

ItemStage 1Stage 2Stage 3
1100100100
2100100100
3100100 
4100  

 

What sort of measure is best to calculate this?

 

Thanks in advance!

 

 

2 ACCEPTED SOLUTIONS
d_gosbell
Super User
Super User

It would be easier if we could see the data as it exists in the tabular table. But if I understand your issue correctly the following psuedo code should work

 

= SUMX( table1 ,
   IF( calculate(SUM(table1[Value]) , table1[Stage] = "Stage 3) > 0 ,
      IF( table1[Stage] = "Stage 1", table1[Value] )
   )
)

View solution in original post

v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @rgtanna ,

 

Please also try this one.

 

Measure 2 =
VAR hasStage3Items =
    CALCULATETABLE ( VALUES ( Table1[Item] ), Table1[Stage] = "Stage 3" )
RETURN
    CALCULATE (
        SUM ( Table1[Value] ),
        FILTER ( Table1, Table1[Item] IN hasStage3Items && Table1[Stage] = "Stage 1" )
    )

 

 

 

Best Regards,

Community Support Team _ Dale
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
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @rgtanna ,

 

Please also try this one.

 

Measure 2 =
VAR hasStage3Items =
    CALCULATETABLE ( VALUES ( Table1[Item] ), Table1[Stage] = "Stage 3" )
RETURN
    CALCULATE (
        SUM ( Table1[Value] ),
        FILTER ( Table1, Table1[Item] IN hasStage3Items && Table1[Stage] = "Stage 1" )
    )

 

 

 

Best Regards,

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
d_gosbell
Super User
Super User

It would be easier if we could see the data as it exists in the tabular table. But if I understand your issue correctly the following psuedo code should work

 

= SUMX( table1 ,
   IF( calculate(SUM(table1[Value]) , table1[Stage] = "Stage 3) > 0 ,
      IF( table1[Stage] = "Stage 1", table1[Value] )
   )
)

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.