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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
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.