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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Need Help with DAX

Hello, Hope you all are doing great.

 

I am stuck in one conditional DAX formula 
I have one table in which I have 5 Columns trdr1, trdr2, week, trdr1 prft and trdr2 prft.

 

Now I want to calculate profit based on some condition like if trdr1 = 51 and week = 1 than calculate sum of trdr1 prft
and if trdr2 = 51 and week =2 (Suppose week =2 is not present where trdr1 =51 ) than calculate sum of trdr2.

If we have matching values like trdr1 = 51 and week = 1, trdr2 = 51 and week = 1 than it should consider value from trdr1 prft

 

I hope I have explained problem statement fully.

 

Please help me with this problem it will be very helpful to me

 

Thanks in advance

 

3 REPLIES 3
Ajendra
Resolver I
Resolver I

Hello,

 

Share some demo data along with the desire output.

 

Thanks!!

Anonymous
Not applicable

Thanks for your reply,
This solution is static one, I want dynamic measure, Like instead of using trdr1=51 and week =1, I want to sum for all trdrs and weeks.

eliasayyy
Memorable Member
Memorable Member

not sure if i got you correctly but you could try using if or switch 

Condition = 
SWITCH(
     TRUE(),
     AND('table'[trdr1] = 51 , 'table'[week] = 1) , sum('table'[trdr1]),
     AND('table'[trdr2] = 51 , 'table'[week] = 2) , sum('table'[trdr2]),
     AND('table'[trdr1] = 51 , AND('table'[week] = 1, table'[trdr2] = 51)) , sum('table'[trdr1]),

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.