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.
Hello Team,
Please help me to resolve this issue in DAX()
* Projects < 30 Days =
linked in Image
Solved! Go to Solution.
Hi @Anonymous ,
Please disable the Total in the format pane of the table visual first, then put the measure in it, it should get the correct result.
This because you are using selectedvalue() in your measure, when you enable Total label, it will return a blank value. In this case, it will return "--" so it cannot be converted into datetime type.
Best Regards,
Yingjie Li
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Please disable the Total in the format pane of the table visual first, then put the measure in it, it should get the correct result.
This because you are using selectedvalue() in your measure, when you enable Total label, it will return a blank value. In this case, it will return "--" so it cannot be converted into datetime type.
Best Regards,
Yingjie Li
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous , check if e is returning date or not. try like
CALCULATE(DISTINCTCOUNT('Compliance Raw Data'[Project ID]),('Compliance Raw Data'[Project Start Date]<=lastdate1 && 'Compliance Raw Data'[Project Start Date]>e))
@Anonymous
Can you share sample of data? It will be easier to check your measure and find the issue.
_______________
If I helped, please accept the solution and give kudos! 😀
Hi,
try to use DATE instead of CONCATENATE function in the VAR e:
* Projects < 30 Days =
VAR a =
MONTH ( SELECTEDVALUE ( 'Compliance Raw Data'[Month & Year] ) - 1 )
VAR c =
IF (
FORMAT ( MAX ( 'Compliance Raw Data'[Today] ), "DD" ) = "31",
"30",
FORMAT ( MAX ( 'Compliance Raw Data'[Today] ), "DD" )
)
VAR d =
FORMAT ( MAX ( 'Compliance Raw Data'[Today] ), "YYYY" )
VAR e =
CONVERT ( DATE ( d, a, c ), DATETIME )
VAR e1 =
CONVERT (
CONCATENATE (
MONTH ( SELECTEDVALUE ( 'Compliance Raw Data'[Month & Year] ) ) & "-",
CONCATENATE ( c & "-", d )
),
DATETIME
)
VAR lastdate1 =
IF ( a = MONTH ( TODAY () ) - 1, TODAY (), e1 )
RETURN
CALCULATE (
DISTINCTCOUNT ( 'Compliance Raw Data'[Project ID] ),
(
'Compliance Raw Data'[Project Start Date] <= lastdate1
&& CONVERT ( 'Compliance Raw Data'[Project Start Date], DATETIME ) > e
)
)
_______________
If I helped, please accept the solution and give kudos! 😀
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |