Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello Power BI Community!
I have some existing Excel syntax that has served me well, but I'm struggling to use it in Power BI.
I have a list of projects with a Start on Site Date (SOS) and a Grand Opening Date (GO). I have previously used the below syntax to provide a status based on today's date; returning: TBC where the date is blank, Pending SOS, On Site, Complete.
=IF(E2="","TBC",IF(TODAY()<E2,"Pending SOS",IF(OR(E2>=TODAY(),TODAY()<=F2,F2=""),"On Site",IF(TODAY()>=F2,"Complete",))))
Where E2 = SOS Date
Where F2 = GO Date
Please can someone help me get this to work in Power BI?
Solved! Go to Solution.
Hi @Aardvark99 ,
Based on your description, I have created a simple sample:
Please try:
Measure =
VAR _a =
MAX ( 'Table'[SOS Date] )
VAR _b =
MAX ( 'Table'[GO Date] )
RETURN
SWITCH (
TRUE (),
ISBLANK ( _a ), "TBC",
TODAY () < _a, "Pending SOS",
OR ( TODAY () >= _a && TODAY () <= _b, TODAY () >= _a && ISBLANK ( _b ) ), "On Site",
TODAY () >= _b, "Complete"
)
Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Aardvark99 ,
If you want to use it for matrix visualisations, pie charts or page filters, you may need to create a calculated column:
Status =
VAR _a =
CALCULATE(MAX ( 'Table'[SOS Date] ))
VAR _b =
CALCULATE(MAX ( 'Table'[GO Date] ))
RETURN
SWITCH (
TRUE (),
ISBLANK ( _a ), "TBC",
TODAY () < _a, "Pending SOS",
OR ( TODAY () >= _a && TODAY () <= _b, TODAY () >= _a && ISBLANK ( _b ) ), "On Site",
TODAY () >= _b, "Complete"
)
Output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Jianbo Li,
The DAX works perfectly in a table.
However, I can't seem to use it for matrix visualisations, pie charts or page filters... I must be doing something wrong 😞
Hi @Aardvark99 ,
Based on your description, I have created a simple sample:
Please try:
Measure =
VAR _a =
MAX ( 'Table'[SOS Date] )
VAR _b =
MAX ( 'Table'[GO Date] )
RETURN
SWITCH (
TRUE (),
ISBLANK ( _a ), "TBC",
TODAY () < _a, "Pending SOS",
OR ( TODAY () >= _a && TODAY () <= _b, TODAY () >= _a && ISBLANK ( _b ) ), "On Site",
TODAY () >= _b, "Complete"
)
Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
9 | |
8 | |
8 |
User | Count |
---|---|
14 | |
12 | |
11 | |
11 | |
8 |