Popular Posts
-
SQLServerCentral » Latest topics Error: 18056, Severity: 20, State: 23 Hi.. Error: 18056, Severity: 20, State: 23. Message The clie...
-
SQLServerCentral » Latest topics No More Service Packs Comments posted to this topic are about the item [B] No More Service Packs [...
-
SQLServerCentral » Latest topics Report queque Does SSRS keep track of reporting running queues? If it does, where I can find it? T...
SQLblog.com - The SQL Server blog spot on the web
Tuesday, August 1, 2017
Need to setup a sql alert on “waiting tasks” - similar to “waiting tasks” in Activity Monitor
Who's Smarter? Humans or AI Systems?
SQL Server geo-cluster 2016
Dear Everyone
Ikeep reading online that its not recommended to virtualize SQL Server clusters (4 nodes)
Are the posted questions getting worse?
Need help in SQL table for updating NULLS
Find Missing Rows Comparing Two Tables
Inv table has invoice numbers and the emloyee name and product.
Each employee eligible to see must be connected to that invoice.
I want to co
New function and the importance of variables in DAX #dax
I recently wrote a few articles about a new function in DAX and the use of variables. For those of you using Power BI or Azure Analysis Services, you always have access to the latest version of the language. Well, in reality I see that new features appears in Power BI Desktop first, and shortly after in Azure Analysis Services. I’m also working on something that will make it easy to recognize which functions is available in each product/version, but this will still require a few months…
So, what is new in DAX? The SELECTEDVALUE function! It’s only syntax sugar, so you can write:
SELECTEDVALUE ( Table[column], "default value" )
instead of
IF ( HASONEVALUE ( Table[column] ), VALUES ( Table[column] ), "default value" )
You will find more details and use cases in the Using the SELECTEDVALUE function in DAX article I recently wrote on SQLBI. My only concern is that this could increase the use of a bad practice, which is getting the value of the current row after a context transition. Something like:
Company := SELECTEDVALUE ( Customer[Name] )
AvgLength := AVERAGEX ( Customer, LEN ( [Company] ) )
instead of:
AvgLength := AVERAGEX ( Customer, LEN ( Customer[Name] ) )
If you think nobody would do that… yes, you’re right, not for the LEN function. But think again to all the calculations that requires a particular granularity and that you would like to include in a measure instead of a calculated column, and then you will realize that making this mistake is more common that you might think. Yes, in more complex expressions, of course.
The other topic that I covered in two articles is the use of variables, which you will find discussed in:
Defining variables in DAX queries Using GENERATE and ROW instead of ADDCOLUMNS in DAXThe basic idea is that you can simplify the syntax of complex DAX expressions by using variables, and the result you obtain is something that is much more similar to an M script rather than the classic nested sequence of function calls in DAX, as I described in another article, DAX coding style using variables. You can see the benefits of this approach in complex calculations, so this is not something that is very visible in short articles, and it will be the major change of future books and patterns about DAX (which is what I’m working on these days).
SSRS Report Security -
SSRS 2012 -we have aset of report all using the same data source:&
Who's Licensed?
Database Mirroring ( Principle , disconnected)
Any known issues with in-place upgrade of a 2 node 2012 AG to 2016?
Calculated Query Help
I am struggling to grasp on how to calculate in SQL where there is a fixed Qty in stock and minus sales order then it should minus from that QTY in stock where it previously taken off the order qty. I have tried mostly everything but I need h
Should I Re-design table?
What should I do with this?