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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Need Help with this DAX query

I have written this query in power query on a Direct query table  sources to create a new  custom column. However my syntax is complaining about a missing token and i cant quit get what the issue is. can you any be kind enough help me with the syntaxt here?

if(
( NOT ( ISBLANK ([ACT_START_DATE] ) ) and ISBLANK ([ACT_END_DATE] ) )
or [ACT_START_DATE]
<= TODAY () + 2,
[FINISH_DATE] - 1
)

4 REPLIES 4
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

Is your problem solved?  If so, kindly mark the proper reply as a solution to help others having the similar issue and close the case. If not, let me know and I'll try to help you further.


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

So can you try my first method, create columns in Power BI Desktop with DAX, I try it is okay.


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-yalanwu-msft
Community Support
Community Support

HI, @Anonymous ;

You could modfiy the column by dax .

COLUMN =
IF (
    (
        [ACT_START_DATE] <> BLANK ()
            && [ACT_END_DATE] <> BLANK ()
    )
        || [ACT_START_DATE]
            <= TODAY () + 2,
    [FINISH_DATE] - 1
)

Or in power quey by M ;

custom=if ([ACT_START_DATE] <> null and [ACT_START_DATE]<> null)  
or [ACT_START_DATE]<= DateTime.LocalNow() 
then Date.AddDays([FINISH_DATE],-1) else null


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

I get this error message - it wants me to switch to import modebut my requirements is to use direct query. do you know if there is a workaround?

 

jokimwele76_0-1667559756262.png

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.