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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
mohittimpus
Helper V
Helper V

Dax give message can't use True and False condition

CALCULATE(COUNT(customer[ID]),DATE(YEAR(TODAY())-1,DATE(YEAR(TODAY())-1,MONTH(TODAY()),DAY(TODAY()))+TIME(HOUR(NOW()), MINUTE(NOW()), SECOND(NOW()))+dayInc))
 
 
var dayInc =
IF (
OR (
MOD ( YEAR ( SELECTEDVALUE ( customer[DATE] ) ), 400 ) = 0,
AND (
MOD ( YEAR ( SELECTEDVALUE ( customer[DATE] ) ), 4 ) = 0,
MOD ( YEAR ( SELECTEDVALUE ( customer[DATE] ) ), 100 ) <> 0
)
),
IF (
MONTH ( SELECTEDVALUE ( customer[DATE] ) ) = 1
|| MONTH ( SELECTEDVALUE ( customer[DATE] ) ) = 2,
1,
2
),
IF (
OR (
MOD ( ( YEAR ( SELECTEDVALUE ( customer[DATE] ) ) - 1 ), 400 ) = 0,
AND (
MOD ( ( YEAR ( SELECTEDVALUE ( customer[DATE] ) ) - 1 ), 4 ) = 0,
MOD ( ( YEAR ( SELECTEDVALUE ( customer[DATE] ) ) - 1 ), 100 ) <> 0
)
),
IF (
MONTH ( SELECTEDVALUE ( customer[DATE] ) ) = 1
|| MONTH ( SELECTEDVALUE ( customer[DATE] ) ) = 2,
2,
1
),
1
)
)
 
-------------------------------
 
I want to count of Value last year same week day till specifec time or currect time.

For Exmaple:  Today Date and Time will be:  09-05-2020 17:25  ----  I want count of last year till same time : 11 -05-2029 till 17:25.




1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

@Mayank08 

try like

 

Measure = 
var _Date =  
        DATE(
            YEAR(TODAY())-1,
            MONTH(TODAY()),
            DAY(TODAY())
        )
        +
        TIME(
            HOUR(NOW()),
            MINUTE(NOW()),
            SECOND(NOW())
        )
        +
        dayInc

RETURN

CALCULATE(
    COUNT(customer[ID]),
    dateTable[Date] >= _Date
)

 

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

8 REPLIES 8
Greg_Deckler
Community Champion
Community Champion

OK, it doesn't look like you even have three parameters for your first DATE function. The second parameter looks to be a return from a DATE function. This is all bad.

 

CALCULATE(
	COUNT(customer[ID]),
	DATE(
		YEAR(TODAY())-1,
		DATE(
			YEAR(TODAY())-1,
			MONTH(TODAY()),
			DAY(TODAY())
		)
		+
		TIME(
			HOUR(NOW()), 
			MINUTE(NOW()), 
			SECOND(NOW())
		)
		+
		dayInc
	)
)

 

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

When i useed your dax that give error message one "day" parameter is missing. 

 

I need use this date like this 

CALCULATE(

    COUNT(customer[ID]),

    

        DATE(

            YEAR(TODAY())-1,

            MONTH(TODAY()),

            DAY(TODAY())

        )

        +

        TIME(

            HOUR(NOW()),

            MINUTE(NOW()),

            SECOND(NOW())

        )

        +

        dayInc

    )

but this give this error message. 

"The True/False expression does not specify a column. Each True/False expressions used as a table filter expression must refer to exactly one column."

az38
Community Champion
Community Champion

Hi @Mayank08 

you need compare your date with some filter. The second argument in CALCULATIE() is filter rule that can return boolean and not date, number or text


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Mayank08
Frequent Visitor


@az38 
Yes try fillter function but thi not work give over count. 

when i use this Dax this work good with Date but not with time. I just need help work with time

 

CALCULATE(
COUNT(customer[ID]),
    DATESBETWEEN(dateTable[Date],
        DATE(
            YEAR(TODAY())-1,
            MONTH(TODAY()),
            DAY(TODAY())
        )
        +
        TIME(
            HOUR(NOW()),
            MINUTE(NOW()),
            SECOND(NOW())
        )
        +
        dayInc,

    DATE(
            YEAR(TODAY())-1,
            MONTH(TODAY()),
            DAY(TODAY())
        )
        +
        TIME(
            HOUR(NOW()),
            MINUTE(NOW()),
            SECOND(NOW())
        )
        +
        dayInc
    
))
az38
Community Champion
Community Champion

@Mayank08 

try like

 

Measure = 
var _Date =  
        DATE(
            YEAR(TODAY())-1,
            MONTH(TODAY()),
            DAY(TODAY())
        )
        +
        TIME(
            HOUR(NOW()),
            MINUTE(NOW()),
            SECOND(NOW())
        )
        +
        dayInc

RETURN

CALCULATE(
    COUNT(customer[ID]),
    dateTable[Date] >= _Date
)

 

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

@az38 @Greg_Deckler 

 

I want this to be count. 

For Exmaple:  Today Date and Time will be:  09-05-2020 17:25  ----  I want count of last year till same time : 11 -05-2029 till 17:25.

 

That measure i am using it work with date level but not with time. so can you plz help on this

 

return CALCULATE(COUNT(customer[ID]),
DATESBETWEEN(dateTable[Date],
DATE(YEAR(TODAY())-1,MONTH(TODAY()),DAY(TODAY()))+dayInc,
DATE(YEAR(TODAY())-1,MONTH(TODAY()),DAY(TODAY()))+dayInc))

@az38  Thanks it work when i use like this way

 

var _Date =
DATE(
YEAR(TODAY())-1,
MONTH(TODAY()),
DAY(TODAY())
)
+
TIME(
HOUR(NOW()),
MINUTE(NOW()),
SECOND(NOW())
)
+
dayInc

var _Date1 =
DATE(
YEAR(TODAY())-1,
MONTH(TODAY()),
DAY(TODAY())
)
+
TIME(
HOUR(00),
MINUTE(00),
SECOND(00)
)
+
dayInc

RETURN

CALCULATE(
COUNT(customer[ID]),
customer[DateCreated] <= _Date,customer[DateCreated] >= _Date1
)
az38
Community Champion
Community Champion

@mohittimpus 

so, now its ok?

if so, please, mark appropriated solution to close the topic


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors