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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
rsant
Frequent Visitor

IF statement: Need to add previous month and previous previous month conditions..

Hi all,

I have an IF statement that I would like to add a previous month and previous previous month condition: 

 

ErrorTier = (IF('fsa'[TotalError%]<3 && sum('fsa'[FundedCount])>=100,"Tier2",
                   IF('fsa'[TotalError%]<3 && sum('fsa'[FundedCount])>=100,"Tier3",
                   "Tier1")))
  • The condition is the same, the only difference is how long they keep it for
  • if someone maintains the two conditions for the previous month they would be labeled Tier2,
  • if they maintain it for two consecutive months they would be Tier3

The date variable is called date1

Thanks!

 
 
1 REPLY 1
speedramps
Super User
Super User

Create a ca;nea table with offsets

See how here ...

https://www.youtube.com/watch?v=zXZAZrUwUe8

https://www.youtube.com/watch?v=5RB3Jdfrn1s

 

The create dax measures to get the ErrorTier for each month

ErrorTier0M = CALCULATE( [ErrorTier], 'Calendar'[monthoffset] =0)

ErrorTier1M = CALCULATE( [ErrorTier], 'Calendar'[monthoffset] =-1)
ErrorTier2M  = CALCULATE( [ErrorTier], 'Calendar'[monthoffset] =-2)

Your answer =
SWITCH(  True(),
ErrorTier 0M= ErrorTier1M     &&     ErrorTier 0M = ErrorTier 2M     , "Tier3",
ErrorTier 0M = ErrorTier1M    ,  "Tier2",
ErrorTier 0M)

 

Thanks for reaching out for help.

I put in a lot of effort to help you, now please quickly help me by giving kudos.

Remeber we are unpaid volunteers and here to coach you with Power BI and DAX skills and techniques, not do the users job for them. So please click the thumbs up and accept as solution button. 

If you give someone a fish then you only give them one meal, but if you teach them how to fish then they can feed themselves and teach others for a lifetime.  I prefer to teach members on this forum techniques rather give full solutions and do their job. You can then adapt the technique for your solution, learn some DAX skills for next time and soon become a Power BI Super User like me. 

One question per ticket please. If you need to extend your request then please raise a new ticket.

You will get a quicker response and each volunteer solver will get the kudos they deserve. Thank you ! 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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