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
ronaldbalza2023
Continued Contributor
Continued Contributor

DAX Measure

Hi everyone, could someone translate this into DAX, please. Appreciated the help in advance 🙂

 

Q1, Q2 is based on the selected value of a quarter

 

IF Revenue > Target in Q1

   THEN Revenue Q2 = Revenue

ELSE Revenue < Target in Q1

  THEN Revenue Q2 = Revenue minus Target

 

Attached is the sample data 🙂 https://www.dropbox.com/s/vud41owacppamfw/Sample%20Data.pbix?dl=0 

 

 

1 ACCEPTED SOLUTION
AllisonKennedy
Community Champion
Community Champion

@ronaldbalza2023  If I understand you correctly: 

 

IF Revenue > Target in Q1

   THEN Revenue Q2 = Revenue

ELSE Revenue < Target in Q1

  THEN Revenue Q2 = Revenue minus Target

 

Assuming you have only 1 year selected:

 

Projected Revenue = 

VAR _SelectedQuarter = SELECTEDVALUE(DimDate[Quarter])

RETURN

IF( [Revenue] > [Target] , [Revenue], [Revenue] - [Target] )

 

This will create a measure, so not sure how you want to use this ultimately. Does it need to be cumulative?


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

2 REPLIES 2
AllisonKennedy
Community Champion
Community Champion

@ronaldbalza2023  If I understand you correctly: 

 

IF Revenue > Target in Q1

   THEN Revenue Q2 = Revenue

ELSE Revenue < Target in Q1

  THEN Revenue Q2 = Revenue minus Target

 

Assuming you have only 1 year selected:

 

Projected Revenue = 

VAR _SelectedQuarter = SELECTEDVALUE(DimDate[Quarter])

RETURN

IF( [Revenue] > [Target] , [Revenue], [Revenue] - [Target] )

 

This will create a measure, so not sure how you want to use this ultimately. Does it need to be cumulative?


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

AllisonKennedy
Community Champion
Community Champion

@ronaldbalza2023  If I understand you correctly: 

 

IF Revenue > Target in Q1

   THEN Revenue Q2 = Revenue

ELSE Revenue < Target in Q1

  THEN Revenue Q2 = Revenue minus Target

 

Assuming you have only 1 year selected:

 

Projected Revenue = 

VAR _SelectedQuarter = SELECTEDVALUE(DimDate[Quarter])

RETURN

IF( [Revenue] > [Target] , [Revenue], [Revenue] - [Target] )

 

This will create a measure, so not sure how you want to use this ultimately. Does it need to be cumulative?


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

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.