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.
When loading data from a database to power bi prciso I use a conditional, for example, select column from table where's Columna> ColumnB
Solved! Go to Solution.
Hi vitexo87,
Yes, we can use Case expressions when we connect to SQL Server database. Please refer to screenshots below:
Best Regards,
Qiuyun Yu
Hi vitexo87,
From your description, I'm not very clear about your question? Would you please elaborate the issue?
By the way, in power BI Desktop, to get data from a SQL Server database, we are able to write a SQL query with Where clause contained.
If you have any question, please feel free to ask.
Best reagrds,
Qiuyun Yu
after making the load of the data I need to edit the query that burden for future charges and enter the option of editing queries from power two and click on the table in question shows the script runs this charge, it is possible to edit this script? if yes how the script would be to apply a condicionao a column is greater than the other, for example: Source = {[Item = "FTEGF_RequisicaoBloqueada" Schema = "dbo" Catalog = "TeresinaDw"]} [Date]
Hi vitexo87,
In Power BI Desktop, after importing data, we can also edit query in Advanced Editor. The Power query to get SQL Server database data with Where clause should look that:
Reference:
Power Query Formula Language in Power BI Desktop
If you have any question, please feel free to ask.
Best regards,
Qiuyun Yu
It is also possible to use the "CASE" function?
For example:
"CASE WHEN CentroCusto_ID is null
THEN 0
ELSE CentroCusto_ID
END THE CentroCusto_ID "
Hi vitexo87,
Yes, we can use Case expressions when we connect to SQL Server database. Please refer to screenshots below:
Best Regards,
Qiuyun Yu
It's not recommended to type a custom SQL query when loading data into Power BI - this stops the query from using "query folding". Query folding is when the query sends the instructions back to the database to do the processing at the database level as opposed to having the Power BI engine process the query instructions. Query folding is good because the database engine will usually complete these operations much quicker. If you write a custom SQL statement then all other later operations in your query won't be able to query fold.
Better options - create a view in the SQL database and use that to pull in your data OR use the Power BI query editor.
Short answer, you can use the CASE statement but there are better approaches.
Hi vitexo87,
Yes, we can use Case expressions when we connect to SQL Server database. Please refer to screenshots below:
Best Regards,
Qiuyun Yu
thank @v-qiuyu-msft
It was the same to my question, I'm trying to apply a condition such as "where" that would bring all the table information from the column The values are greater than the column B, for example, where Column_A> Column_B
What exactly is the question?
Maybe you're asking, should you include the conditional in the SQL code or do the filtering in the Power BI query editor instead?
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 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |