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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
CJKPowerBI
Helper I
Helper I

formula in excel make it in PowerBi

Hello all,

 

i have the below formula in excel which basically checks today's date and if before this month 23rd day then it puts the 15th of this month, if todays date is more than 23rd of this month then it puts the 15th of the next month.

 

=IF(OR((($C2)="Option1"),(($C2)="Option2")),IF(DAY($E2

<=23,DATE(YEAR($E2),MONTH($E2)+1,15),EOMONTH($E2,1)+15),$E2)

 

how can i transform it to be used in a column or measure in Power BI?

 

thank you in advance

1 ACCEPTED SOLUTION

@CJKPowerBI 

Please try

Amount to be paid on =
IF (
    OR ( [Charge] = "Text 1", [Charge] = "Text 2" ),
    IF (
        DAY ( [Transcation Date] ) <= 23,
        DATE ( YEAR ( [Transcation Date] ), MONTH ( [Transcation Date] ) + 1, 15 ),
        EOMONTH ( [Transcation Date], 1 ) + 15
    ),
    [Transcation Date]
)

View solution in original post

7 REPLIES 7
tamerj1
Super User
Super User

Hi @CJKPowerBI 

Same formula should work just fine for a calculated column, just replace the cell references with column references. 

lukiz84
Memorable Member
Memorable Member

In a calculated column the syntax is the same, you just have to change 2 things:

 

$C2 must be the column in your table 

$E2 must be another column in your table (where you have the data)

 

My formula gives me an error after those modifications, can you have alook and maybe paste the formula for PowerBi here pls?

@CJKPowerBI 

Please paste your formula here in order to be able to amend. 


Below is the formula:

 

Amount to be paid on = IF(OR(([Charge]="Text 1"),([Charge]="Text 2")),IF(DAY([Transcation Date]<=23,DATE(YEAR([Transcation Date],MONTH([Transcation Date])+1,15),EOMONTH([Transcation Date],1)+15),[Transcation Date])

@CJKPowerBI 

Please try

Amount to be paid on =
IF (
    OR ( [Charge] = "Text 1", [Charge] = "Text 2" ),
    IF (
        DAY ( [Transcation Date] ) <= 23,
        DATE ( YEAR ( [Transcation Date] ), MONTH ( [Transcation Date] ) + 1, 15 ),
        EOMONTH ( [Transcation Date], 1 ) + 15
    ),
    [Transcation Date]
)

thank you @tamerj1  that worked great...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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