Remove today´s data from my report in powerBI - powerbi

I would like to ask if someone know how to remove today´s data from my report in powerBI. I need only yesterday´s and older data but I don´t know how to remove only today´s dynamically, for every new day. So tomorrow, I need remove only tomorrow´s data and let today´s data and older. I tried IF( [date] <> today(), [date], blank()) But this is not working, my whole report showing very inaccurate data. Thank you.

Related

Creating a summarizecolumns filling blank data with zero

I'm kind of new with DAX and I'm currently stuck with a problem.
I have two tables Fiscal Calendar and Customer. I created a relationship using the date columns from both table.
The customer table contains records and I would like to show on a matrix if a record exist or not on specific dates (or fiscal weeks) like in the image below.
I made a summarizecolumns table (see the dax sentence below) however, what I need is if the record doesn't exist on specific date/week, I want to fill it with zero value instead of having it just blank. I tried many things already but until now I couldn't find any solution. If anyone is willing to help me I would really appreciate it.
Adherence =
var customerNames = VALUES(Customer[CUST_NAME_EXT])
var customerNumber = VALUES(Customer[CUSTOMER_EXT])
var selectedDates = VALUES('Fiscal Calendar'[fiscalDate])
var filterCustomerNames = FILTER(Customer,Customer[CUST_NAME_EXT] in (customerNames))
var filteDates = FILTER('Fiscal Calendar', 'Fiscal Calendar'[fiscalDate] in selectedDates)
var filterCustNumber = FILTER(Customer, Customer[CUSTOMER_EXT] in customerNumber)
var t = SUMMARIZECOLUMNS(Customer[CUST_NAME_EXT],Customer[CUSTOMER_EXT],'Fiscal Calendar'[fiscalYear],'Fiscal Calendar'[fiscalWeek], filterCustNumber ,"isAvailable", 1)
return t
First, I want to give you kudos for using SUMMARIZECOLUMNS. If I understand you correctly, you were trying to write DAX as if it is an SQL query, but it is not the case. To know the difference between them, you can read my answer to {How to write SQL in DAX?} question using this link:
How to write SQL in DAX?
Still, you can do it more easily by using the Power BI modeling strength because you said you had created a relationship using the date columns from both tables, Fiscal Calendar and Customer.
Second, to achieve your requirement, you need to create a flag to show 1 if a customer exists on a date or week and 0 if not, which, thankfully, can be implemented for any segregation level (columns) in your Fiscal Calendar table, just by two simple measures, which are as follows:
Count Rows = COUNTROWS(Customer)
Adherence = IF(ISBLANK([Count Rows]),0,1)
Finally, as your image shows, you will use the simple Adherence measure to give you the needed result.
In the end, I want to give you a helpful tip; I see you are trying to create a custom heat map using the Power BI matrix, which is very cool. Please use this link as a reference for more design ideas for what you are trying to achieve. The link is:
https://sqlskull.com/2020/12/17/implementing-a-table-heat-map-in-power-bi/#:~:text=A%20Heat%20map%20is%20used%20to%20visualize%20the,to%20apply%20some%20conditional%20formatting%20in%20matrix%20table.
I hope I helped in a way; if so, please mark this as an answer and vote for it :)

PowerBI - Draw Line Chart with X Axis Grouped by Date (in Days), When Column contains Full timestamp?

I've been trying to figure this for several hours now.
In my SQL table I have a full timestamp column, with date and time of the action, e.g. last time a user was logged in.
Say I have two users who logged in today so far, in different hours. I want to see "2" log ins for today's Date, instead of seeing them broken down further into exact timestamps.
See screenshot for example
What's the easiest way to do this?
EDIT:
Seems like the whole issues stems from my desire to use "Direct Query" method to load the data.
If I'm just importing the whole table (as users_table (2)), Then yes, I can create a new column with this syntax:
Column = 'users_view (2)'[last_active].[Date]
And plot the graph that I Want.
However, I am unable to create this column on direct query mode. Trying to create this column leads to an error:
Column reference to 'last_active' in table 'users_view' cannot be used
with a variation 'Date' because it does not have any.
If such basic functinoally is not possible, then what's the merit of Power BI? my use case is to create a REAL time dashboard.
Seems like if I want to have anything in real time, it means I can't build even the most basic graph, and vice-versa.
So either I'm missing something, or Power BI is worthless for real time reporting.
You need to follow these steps:
In your fact table, create a new column that corresponds to the date of the timestamp (this will be a grouping dimension column for your timestamps)
Add a measure that counts rows of your table
In a new chart, e.g. line chart, bar chart, whatever - use the date column as X-axis information, and the row count measure as your Y-axis information
Edit: Since it is now apparent you insist on using Direct Query for this - it would appear your data is not in the correct format to support what you want to do. The solution would be to provide Power BI with the correct format for the analysis you want to do. Like adding a column in your SQL database table.
A very costly way of calculating "something" useful would be to do a cumulative count based on timestamp that resets daily. This will look messy but for a site with a lot of activity it will be able to plot something. But it will be slow - since obviously we are far, far away from what would constitute a "sensible" use-case for Power BI using Direct Query.
Cumulative Daily Logins =
VAR _max_time = MAX ( users_table[last_active] )
VAR _date = DATEVALUE ( _max_time )
RETURN
COUNTROWS (
FILTER (
ALL ( users_table ) ,
users_table[last_active] <= _max_time
&& DATEVALUE ( users_table[last_active] ) = _date
)
)

How do I restrict a report to only show current data

I'm brand new to Power BI and I'm used to setting up most of my data in SQL Server (for SSRS). I have a data set and I was able to add in a Calendar table with my dates. My goal is to do a Year-over-year comparison. I got the year-over-year part working with the help of a couple of tutorials, but I want to restrict the report output to only data up to the last end of month (otherwise the YoY shows a case differential for dates out into 2021 - not helpful). I need a dynamic filter and all I seem to be able to set are static filters. This filter needs to be on the data itself - nothing a user can or should touch. Any help would be appreciated.

Is there a way to easily count rows in a table on the report page in powerbi?

After creating a table on the report tab I need to count the number of rows that are in the table, this seems SUPER easy, right? I agree, it should be.
Well, if I add in another field into the "values" list and try to make this a "count" or "count (distinct)" type then the table's filters seem to be affected and I get different information in the table than what I had seen previously. WEIRD.
So, I need a way to count the number of rows in a table on the report tab without adding in another column to the table.
Any suggestions would be appreciated. Can provide more information if needed!
CreatedCounts =
CALCULATE(COUNT('Bugs - All history by month'[Work Item Id]),
DATESBETWEEN('Bugs - All history by month'[Created Date],
MIN('Bugs - All history by month (2)'[Iteration Start Date]),
MAX('Bugs - All history by month (2)'[Iteration End Date])))
This is what I came up with, and it works exactly as I want from what I can tell, but I don't really 100% understand WHY it works, so if anyone can provide an explanation (or better solution!) please let me know, thanks!

Power BI Slicer not formatting properly

In my report, my date dropdown slicer looks like this when the report first loads:
I want it to display without all the extra time and timezone nonsense like it does when I manually select one of the boxes after the report loads:
Does anyone know why this happens or how to fix it?
Edit: Here's a minimal .pbix example: Link to File
I'm on the August 2018 version now, and it seems to me that this issue has been fixed.
At least I'm not able to reproduce it.
With a dataset like below, a Line Chart and a regular Slicer, I get this:
Date,Value
2017-01-12,1
2017-01-13,4
2017-01-14,2
2017-01-15,4
2017-01-16,2
2017-01-17,2
2017-01-18,2
2017-01-19,5
2017-01-20,5
2017-01-21,5
2017-01-22,5
2017-01-23,6
2017-01-24,3
2017-01-25,6
2017-01-26,6
2017-01-27,5
2017-01-28,8
2017-01-29,4
2017-01-30,2
The slicing details (the All part in Date All) can be turned off by setting Filter Restatement under Slicer Header to Off. Maybe that would have solved the issue?
Please note that I've ignored the date hierarchies in both the Line Chart and the Slicer:
As a suggestion, you might want to try creating a new Column using the FORMAT function.
This is something I often do to provide a more human readable date for my slicer.
EG:
DisplayDate = Format([SomeDateField], "ddd d mmm yyyy" )
Once done - you will want to select the column - then SORT by your original date column. Otherwise you may get some odd results ;)