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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
AFRATH34
Helper I
Helper I

Help me to write the Measure calculation in Power BI

Hi Team,

 

I hope this email finds you well.

 

I need assistance with writing a Measure calculation in Power BI that involves two conditions. Although I have mentioned the two conditions correctly in the attached ScreenShot and tried to create the formula based on them, it is not working as expected..

 

Here are the details:
- I am using a slicer for Date filter, and the dates are available in the "Date_Table" table.
- The measure should calculate the output based on the selected date filter values.

 

Please refer to the attached ScreenShot for the exact conditions and the expected result. Your help in providing the correct formula for this measure would be greatly appreciated.

condition.pngTable.pngOutPut.png

Thank you for your support.

 

Best regards,
Afrath

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @AFRATH34 

 

Before write a measure, you need to change the format of "New_date1" and "New_date2" to the date type.

vjialongymsft_0-1721981891592.png



Then try the following measure:

MEASURE =
IF (
    SELECTEDVALUE ( 'All'[New_Date1] )
        < SELECTEDVALUE ( Date_Table[SelectedMonthEnd] )
        && SELECTEDVALUE ( 'All'[New_Date1] )
            > SELECTEDVALUE ( Date_Table[SelectedMonthStart] ),
    SELECTEDVALUE ( 'All'[Upfront Gross Profit] )
        * SELECTEDVALUE ( 'All'[IG Forecast TCGP] ),
    BLANK ()
)

 

Measure2 =
IF (
    SELECTEDVALUE ( 'All'[New_Date2] )
        < SELECTEDVALUE ( Date_Table[SelectedMonthEnd] )
        && SELECTEDVALUE ( 'All'[Expiry Date] )
            >= SELECTEDVALUE ( Date_Table[SelectedMonthStart] ),
    SELECTEDVALUE ( 'All'[Recurring Gross Profit per Period] )
        * SELECTEDVALUE ( 'All'[IG Forecast TCGP] ),
    BLANK ()
)

 

 

Result:

vjialongymsft_1-1721982003905.png

 

 

 

 

 

 

 

 

Best Regards,

Jayleny

 

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

7 REPLIES 7
Anonymous
Not applicable

Hi @AFRATH34 

 

Before write a measure, you need to change the format of "New_date1" and "New_date2" to the date type.

vjialongymsft_0-1721981891592.png



Then try the following measure:

MEASURE =
IF (
    SELECTEDVALUE ( 'All'[New_Date1] )
        < SELECTEDVALUE ( Date_Table[SelectedMonthEnd] )
        && SELECTEDVALUE ( 'All'[New_Date1] )
            > SELECTEDVALUE ( Date_Table[SelectedMonthStart] ),
    SELECTEDVALUE ( 'All'[Upfront Gross Profit] )
        * SELECTEDVALUE ( 'All'[IG Forecast TCGP] ),
    BLANK ()
)

 

Measure2 =
IF (
    SELECTEDVALUE ( 'All'[New_Date2] )
        < SELECTEDVALUE ( Date_Table[SelectedMonthEnd] )
        && SELECTEDVALUE ( 'All'[Expiry Date] )
            >= SELECTEDVALUE ( Date_Table[SelectedMonthStart] ),
    SELECTEDVALUE ( 'All'[Recurring Gross Profit per Period] )
        * SELECTEDVALUE ( 'All'[IG Forecast TCGP] ),
    BLANK ()
)

 

 

Result:

vjialongymsft_1-1721982003905.png

 

 

 

 

 

 

 

 

Best Regards,

Jayleny

 

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

AFRATH34
Helper I
Helper I

Hi @BeaBF , I have accept your drive access request. 

 Sorry for the late response.

 

Thanks,

Afrath

BeaBF
Super User
Super User

@AFRATH34 can you share the pbix file? or instead paste formulas and data so that we can make copy and paste.

 

Thx,

BBF

Hi @BeaBF ,

 

Could you please explain how I can attach the PBIX file?

 

Thank you for your assistance.

 

Best regards,
Afrath

@AFRATH34 UpLload the file in drive and then share the link.

 

BBF

Hi @BeaBF ,

Please find the link to the file: [https://drive.google.com/drive/folders/1fl52xaMFfa5lRMOzGqfwy_MQdbal3tAu ].

I need your support in creating a measure column. I have not created the measure yet and would appreciate your assistance. The desired output for the "J0D8" Opp ID was mentioned in an earlier screenshot.

Here are the conditions for the measure:

  1. If New Date1 < SelectedMonthEnd and SelectedMonthStart <= New Date1, then the measure should be Upfront Gross Profit * IG Forecast TCGP.
  2. If New Date2 < SelectedMonthEnd and Expiry Date >= SelectedMonthStart, then the measure should be Recurring Gross Profit per Period * IG Forecast TCGP.

Thank you for your support.

 

Best regards,
Afrath

 

@AFRATH34 Please accept the request to access the drive.

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.