Power bi sql live data on demand - powerbi

Is there any way to add datepicker to report and based on datepicker value can we get the live data from sql server on demand?
Thanks in advance.

You can pass the date filters in the URL of your report. This means to add a query string parameter like this:
?filter=SalesData/SaleDate ge 2018-01-01 and SalesData/SaleDate se 2018-12-31
To filter the SalesData table on SaleDate field to show only data for 2018.
You can create one helper report with a date table and slicer, which will generate the actual link to your report. To do this, create a new calendar table (from Modeling -> New Table) with the dates you want, e.g.:
Date = CALENDAR (DATE(2000;1;1); DATE(2030;12;31))
Create a new measure to calculate the filtered URL:
ReportUrl = "https://app.powerbi.com/groups/xxxxx/reports/xxxxx?filter=SalesData/SaleDate ge " &
FORMAT(MIN('Date'[Date]); "yyyy-MM-dd") &
" and SalesData/SaleDate se " & FORMAT(MAX('Date'[Date]); "yyyy-MM-dd")
Do not forget to replace xxxxx with actual group and report IDs. Make sure the measure data category is Web URL to make it a hyperlink. Show it somewhere, where the user can click on it:

Related

Default slicer selection (latest date) in Power BI

My requirement is when a report will be opened in Power BI services by default, the latest date will be selected in a single select slicer.
Consider in import mode there are 10 dates are coming and assigned to a slicer (single select dropdown). By default it shows the older date as the selected date.
I need to do the opposite. It should be the latest date selected by default and if the user wants to select other dates they can change manually. My landing page by default should show the latest date dynamically.
It's not possible to select the latest date in slicer automatically. However, there is a kind of workaround for this which I have explained below.
Just create an additional column using original date like this:
Date 2 = IF('Table'[Date] = TODAY(), "Today", FORMAT('Table'[Date], "MM-DD-YYYY"))
Then use this newly created column in your slicer and manually select 'Today' in that slicer once and publish the file to the Power BI service. So the end user will always see 'Today' selected in a slicer by default which obviously represents the current date.
Note: if you want latest date to be selected which is not necessarily current date then you can create the column below:
Date 2 = IF('Table'[Date] = MAX('Table'[Date]), "Latest Date", FORMAT('Table'[Date], "MM-DD-YYYY"))

Slicer Only Show Month / Year and Filter On That

I have a table with a value ReportDate, which is in the format '03/01/2020'. I want to create a slicer in my Power BI report that displays only the format '03/2020' and the user can then select the value of the month and year to display, and it will display the data for that month (regardless of the day value). How would one go about doing this? I know technically I can add a new column in the database table, but unfortunately I do not have access to changes in the database and as such, would like a Power BI solution.
In the Power Query Editor create a new column with formula
Date.ToText([Date], "MM") & "/" & Date.ToText([Date], "yyyy")
Change [Date] to whatever your date column is called. Date.ToText converts a date time to text, which is then concatenated. You can then filter on that column. For issues like this it is best to have some sort of calendar table.
You can create a new column in using query editor in power bi:
mon_year = left(<column_name>, 3) & Right(<column_name>, 4)
Note: Make sure your are connected to dataset in import mode because in live connection you will not be able to create New Column in Power BI.

Tableau data extract refresh

So I have this database which I will build a dashboard with. A tableau admin will refresh d extract everyday.
example of data
Date item
1-jul. Book
2-jul. Cane
.
.
24-jul Rice
25-jul. Car
Everyday new row is added
Question: how do I set up my date range filters in d data source view so that the extract refreshes by the admin will reflect the current data always.
One solution although bit long is:
Create calculated field "date2" as type date (based on date info from your data.) use date function if e.g year id missing.
Create calculated field "max date" as type date (max(date2))
then create yet another calculated field "max date filter"
If date2 = [max date] then 1 end
Drag filter field to filters and set it to 1
Drag item to rows

Between Date Range Filter PowerBi

What is the easiest way to create a filter on a table that is between date ranges?
I have a table.field called tag_enquiries.datecreated. How do I get a filter for between the first of June to the last day of June. I am sure this will be in a measure.
For your table, under Visualizations select the Fields symbol then under Filters, open your date field. You can choose "Advanced filtering" and create a logical construct such as:
Of course, you can also deploy without a filter and use a slicer on a date field and select "Between" from the list
In Visualizations tab Select filter option and assign date data in value. After that select data and visualize

Dax: How to apply filter function on a column?

I am trying to create a report and i have a table of data which is having project name,pro id,emp name,id, location(off/onsite) like all are basic info about the each employee.
I am using RLS so that when ever a person can login to this report he can view their own personal data.
When i login to this report, then i can able to see the project id's which are having under my list.
Now i am trying to show the basic emp details in a table like as emp name, id, role and location.
But in table i can see the only value of the person who login to the report.
I cant see the rest of employees which are belong to the same project id and their info in table.
I have tried a dax using calculated table funtion as below for only single pro id by using NEW TABLE option.
Table =
CALCULATETABLE(
SUMMARIZE('Basic Info','Basic Info'[Employee ID],'Basic Info'[Employee Role],'Basic Info'[Employee Name]),
FILTER('Basic Info','Basic Info'[Project ID]="C.0010978"
))
And it is giving the output for that perticular project.
But if i remove that hard coded pro id and put column of the pro id from table as
Table =
CALCULATETABLE(
SUMMARIZE('Basic Info','Basic Info'[Employee ID],'Basic Info'[Employee Role],'Basic Info'[Employee Name]),
FILTER('Basic Info','Basic Info'[Project ID]='Basic Info'[Project ID]
))
then it is not filtering the values as the projects filtered from the slicer as show in above image.
It is showing all the emp names and their data.
Any suggestions.
Thanks in advance,
Mohan V.
You cannot use slicer values in a calculated column. Calculated columns are evaluated during the data load and are not responsive to any visuals, filters, or slicers.
You may want to try using a measure instead of a calculated column.
Try searching the web for "power bi column vs measure" for more info on how each one is used.