I encountered a situation that the WHERE clause in a SQL query changes based a parameter. When the parameter is '_All', there is no restriction. When the parameter is any other value, an AND section in the WHERE clause is needed.
After some digging, I found an elegant solution. Using
(@parameter = '_All' OR Field_X=@parameter). It greatly simplied the SQL query and fixed the problem of NULL value is hard to handle.
The post I saw is: http://dotnet.org.za/ilo/archive/2005/05/31/21280.aspx
Connecting Power BI Semantic Models To Data Sources Automatically With
Binding Hints
-
Did you know that you can configure your Power BI semantic model so that it
automatically binds to a data source connection when you publish? To
illustrate...
4 weeks ago
No comments:
Post a Comment