This post is also available in: DeutschDeutsch

Automatically filter report on actual date with calculated column and with measure

This post is also available in: Deutsch Sooner or later, every Power BI developer will face the question of how to automatically filter a specific visual or the entire report to today’s date.This can be done in two ways: With a Calculated Column (always works) With a measure (works in specific cases) The approach with a calculated column is much more stable, since measures generally cannot or should not be used as filters. However, if the date exists in the filter context, then this is also possible with a measure, which is why I will present both alternatives. Filter to today’s date with calculated column As just said, filtering by calculated column is the more stable of the two approaches. Here, a new calculated column is created in the date dimension, where it is simply checked whether the date in the particular row matches today’s date: In this way, the content of the new calculated column is always “0”, except for the current date. On this day the line shows a “1”: The new column can now be used to filter single visuals or the whole report on today’s date. As soon as the day changes, the value in […]
This post is also available in: Deutsch One topic that I think doesn’t get enough attention is the ability to automate work in Power BI with the Tabular Editor. Especially the official documentation gives some nice insights into what the scripting engine can achieve.I would like to present a few examples in this article. Example 1: Automatic formatting of all measures If you often work with Power BI, you know the situation when you open a report and all measures look like in the following picture: Without proper formatting, it’s hard to tell here what the formula is doing at all. If all measures in the report look like this, there is a big frustration. However, the Tabular Editor’s scripting engine provides a remedy for this. This can be started easily via the external tools: In the Tabular Editor, the following C# code can now be entered via the “Advanced Scripting” field: After a click on “Run Script” (green arrow) or a click on the F5 key the code will be executed. After that the changes have to be written back from the Tabular Editor into the opened Power BI file (Ctrl + S) or File –> Save and […]
This post is also available in: Deutsch Although the feature has been in Power BI for a while, Measure Tables are not used enough in my opinion. Also during my trainings or in conversations with customers, I often notice that the feature has not really reached the minds of the report developers yet. What is a Measure Table and what does it look like? A measure table is an independent table that does not contain any columns and only the measures themselves: When should I use a Measure table? I personally use them when I have more than 4-5 measures. I find it more clear to have a large number of measures in a separate table instead of scattered between the columns of the fact table. But basically, you can also agree as a company to always use Measure Tables, which improves the user experience. Instead of picking a specific measure from the table below: …. is it easier to find a measure in the following table: What are the special characteristics of the Mesaure table? Including the just mentioned example of clarity, a Measure table has a few unique features: Own iconUnlike the other tables, the Measure table […]
This post is also available in: Deutsch Power BI Embedded is a great way to integrate entire reports or specific elements from a Power BI reports into a company portal. Unfortunately, this is not always easy to explain and you need some imagination to grasp how this might look in practice. Power BI Embedded as a demo portal However, this has recently changed as Microsoft has released a demo portal for their imaginary company Contoso. On the following website you can find a great example how to use Powe r BI Embedded in an enterprise portal. Important here, the portal must be entered in demo mode. Afterwards you get a good impression of how such a portal could look like: Integration of analysis and individual portal functions It is also very well solved how certain functionalities of a portal have been integrated directly next to the analysis. A new lead can be created via the “Add new Lead” function (unfortunately not in demo mode) and the leads from Power BI are displayed directly below. Source code of the portal available on Github Finally, here’s the best part. The source code for the entire portal is released at Github, so […]
This post is also available in: Deutsch Last week we already dealt with the topic of the correct calculation of the ISO week in DAX. Since the question came up about how to solve this in Power Query, I will look into it this week. For the problem with calendar weeks, I would like to refer to last week’s post. Calculation of US calendar week with Date.WeekOfYear function Like in DAX, there is already a function in Power Query to calculate the calendar week. This is called Date.WeekOfYear and returns the US format with week start on Sunday. With an optional parameter, the calendar week is returned with week start on a Monday. The syntax looks like this: Calculation with Power Query function Unfortunately, there is no hidden parameter in Power Query like in DAX, so we have to calculate the calendar week. However, Robert K. Bell has already done most of the preparation work. Based on his code, I modified the function a bit for our purposes. The following code you simply have to paste into a new query in Power Query: After that you only have to call the function as a new column with the parameter […]