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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
ThomasDay
Impactful Individual
Impactful Individual

VAR and Brain Cramp

This is really a brain cramp and pretty embarrassing to be honest.  I get athe error "The syntax for 'RESULT' is incorrect" when attempting to calc a column for the code below.   I'm trying to do the snippet shown at the end...which gives the error---and so I whittled it down and down and down to the following which ALSO gives the error, so I clearly don't understand the issue. (This is a calculated column in the same table as [Bed Size]!)  

 

CohortForPerformance =
       VAR SizeCategOfFacil = MeasureReptRecNoProviders[Bed Size]
       RESULT 

       SizeCategOfFacil

 

----And here's the thing I'm trying to do....which is an interim calc for other stuff.  Any help would be great!

CohortForPerformance = 
VAR SizeCategOfFacil = MeasureReptRecNoProviders[Bed Size]
VAR SizeID = Switch (
TRUE(),
SEARCH("400 and over",SizeCategOfFacil,1,0)<>0,"400+",
SEARCH("250 to 399",SizeCategOfFacil,1,0)<>0,"250 to 399",
SEARCH("100 to 249",SizeCategOfFacil,1,0)<>0,"100 to 249",
SEARCH("26 to 99",SizeCategOfFacil,1,0)<>0,"26 to 99",
SEARCH("25 and under",SizeCategOfFacil,1,0)<>0,"25 and under",
"")
RESULT
CONCATENATE("Acute ",SizeID)
1 ACCEPTED SOLUTION
Vvelarde
Community Champion
Community Champion

Hi @ThomasDay

Use Return instead of Result




Lima - Peru

View solution in original post

10 REPLIES 10
Sean
Community Champion
Community Champion

@ThomasDay Smiley LOLSmiley LOLSmiley LOL

 

Time to go outside and take a dip in whatever body of water is near you... Smiley LOLSmiley LOLSmiley LOL

ThomasDay
Impactful Individual
Impactful Individual

Bwahahahahahahahaha.....oh, that's beautiful.  Yes, I'm going to get on my bike and just pedal.  To much bi makes for too little pi (personal intelligence) .

 

Well, it isn't the first time and won't be the last time it happens, but I SURE hope I'm not alone on this.
@Sean PS: the nearest body of water is Cape Cod bay--1 mi.  Tom

Vvelarde
Community Champion
Community Champion

Hi @ThomasDay

Use Return instead of Result




Lima - Peru
ThomasDay
Impactful Individual
Impactful Individual

@Vvelarde   Thank you...

Sean
Community Champion
Community Champion

@ThomasDay Have you tried the Power Pivot Utilities Add-In => http://www.sqlbi.com/tools/power-pivot-utilities/

 

Its for Excel but there are very helpful features for your Power Pivot Data Models built in Excel.

 

There's a List Measures button => creates a New Excel Sheet and a Table with ALL your Measures => amazing time saver!!!

 

It would be great if we can get this in PBI?

 

Here's a review by @MattAllington => http://exceleratorbi.com.au/fabulous-new-excel-add-power-pivot/

 

people who may also find it useful @ImkeF @kcantor @heathernicole @Seth_C_Bauer

very usefel. fortunately DAX Studio can do much of it as well: http://exceleratorbi.com.au/getting-started-dax-studio/ 

this works with pbi ☺

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

ThomasDay
Impactful Individual
Impactful Individual

Hey @Sean  Just got back from that bike ride you prescribed  🙂 

 

These utilities look fabulous...though regrettably I am entirely Powerbi desktop or .com so can't take advantage of them.  Oh well.  It's really really useful to have all of those things.  I take screenshots of my relationships so that when I need to rebuild a table (delete/redo sort of thing) I can get the relationships right given the junk that auto process generates.  (I suppose I should figure out how to turn that off.)

 

Tom

 

 

 

 

Sean
Community Champion
Community Champion

@ThomasDay Smiley LOL Yes! You were approaching Dangerously Low Levels of PI Smiley LOL

 

@ImkeF I do use Dax Studio - however I can't get it to export the Measures to an Excel file - only txt and csv???

 

I don't see the options that Matt describes on his page

DAX Studio Instructions.png

 

All I get is this...

DAX Studio.png

 

UPDATE: Happy to report that it seems now the option is showing up!!! @ThomasDay you should give this a try!

 

DAX Studio Update.png

ThomasDay
Impactful Individual
Impactful Individual

@Sean yes indeed.  I've used DAX studios as a barely functional rookie to give me documentation around measures.  I was unaware that it could connect to a .pbix file, which it does famously.  That's awesome.  SQL isn't something I know, but the built in's do a few really useful things....thanks for the tip and @ImkeF, as always, thanks for the DAX studios nudge.

kcantor
Community Champion
Community Champion

@Sean is correct! That is a fantastic utility.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.