Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi,
I am hoping someone can help.
I Want to create a Switch column. I have this formula:
DayRange =
SWITCH (
TRUE (),
Table[Date] <> BLANK ()
&& Table[Date1] <> BLANK(), "Other",
Table[Date] <> BLANK ()
&& [NoOfDays] > 365, "> 12 Months",
Table[Date] <> BLANK ()
&& [NoOfDays] > 274, "> 9 Months",
Table[Date] <> BLANK ()
&& [NoOfDays] > 183, "> 6 Months",
Table[Date] <> BLANK ()
&& [NoOfDays] > 91, "> 3 Months",
Table[Date] <> BLANK ()
&& [NoOfDays] <= 91, "< 3 Months",
" N/A"
)
I am getting this error: Function 'CALCULATE' is not allowed as part of calculated column DAX expressions on DirectQuery models.
I have tried using SWITCH as a measure, but it only shows one citatory. Can anyone get this to work?
Thanks in advance,
Boycie92
Hi @Boycie92,
Maybe you can try to use below formula:
DayRange =
IF (
Table[Date] = BLANK (),
" N/A",
IF (
[NoOfDays] > 365,
"> 12 Months",
IF (
[NoOfDays] > 274,
"> 9 Months",
IF (
[NoOfDays] > 183,
"> 6 Months",
IF (
[NoOfDays] > 91,
"> 3 Months",
IF ( [NoOfDays] <= 91, "< 3 Months", IF ( Table[Date1] <> BLANK (), "Other" ) )
)
)
)
)
)
Regards,
Xiaoxin Sheng
Hi @Anonymous
thanks for the help.
when I use the formula in a column I still get the CALCULATE error.
when I use it as a measure its says "A single value for column 'TableDate' in table 'Table' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result."
Any idea why?
Thanks
Boycie92
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 53 | |
| 45 | |
| 44 | |
| 20 | |
| 19 |
| User | Count |
|---|---|
| 73 | |
| 71 | |
| 34 | |
| 33 | |
| 31 |