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
Anonymous
Not applicable

Previous row with IF formula in Power BI

Hi there, I am trying to convert below given excel formula into power bi formula:

 

prithivi97_0-1635174722118.png

: =IF((I4<>I5)*(E4="No"),"Current",IF((I4<>I5)*(E4="Yes"),"FDR","Not relevant"))

 

I have created the index row starting with 0, 1.. to find the previous value - however, the return value isn't correct in power bi. below is my formula: 

 

prithivi97_1-1635174782626.png

: Column FDR = IF([Position ID] <> [Last Position ID]*([4. Today]="No"), "Current", IF([Position ID] <> [Last Position ID]*([4. Today]="YES"),"FDR", "Not Relevant"))

 

The return values are only "Current" and "FDR". Although, FDR only should come in YES but it shows for No and Current shows for Yes & No. I am not sure what i am missing in this formula...

 

Really appreciate your input in this problem..

 

3 REPLIES 3
v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

According to your description, heres my solution.

vkalyjmsft_0-1635820249343.png

Best Regards,
Community Support Team _ kalyj

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

smpa01
Super User
Super User

@Anonymous  provide sample data and desired output.

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
Anonymous
Not applicable

Hi, thank you for responding..

 

Position ID is the data set and first three columns are excel formula columns. 

 

1. Concat - just random date generated in system and i changed the format to (dd/mm/yyyy). 

2. > Today? - =IF(D3*1>TODAY(),"Yes","No")

3. FDR =IF((G3<>G4)*(E3="No"),"Current",IF((G3<>G4)*(E3="Yes"),"FDR","Not relevant"))

             So technically, if position ID G3<>G4 and >Today is No = the return value should be Current.

             If the psoition id G3<>G4 and > Today is Yes = the return value should be FDR (if true) Not                       relevant (if false)

 

 Column DEFG
 Concat> Today? FDR?Position ID
33/4/2019NoNot relevant50000457
430/4/2019NoNot relevant50000457
520/6/2019NoNot relevant50000457
61/9/2019NoNot relevant50000457
724/10/2019NoNot relevant50000457
87/11/2019NoNot relevant50000457
926/3/2021NoNot relevant50000457
101/4/2021NoNot relevant50000457
1113/9/2021NoNot relevant50000457
121/10/2021NoCurrent50000457

 

In power bi - i have created index column and index_1 to get the last position ID (below cell position id). but the return value in power bi is not as expected. Below was the if function measure i used in power bi.

 

Column FDR = IF([Position ID] <> [Last Position ID]*([4. Today]="No"), "Current", IF([Position ID] <> [Last Position ID]*([4. Today]="YES"),"FDR", "Not Relevant"))

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.

Top Solution Authors