How to write the queries in power bi - charts

I am using Power BI in my current project for making charts. My data source is Azure SQL database.
I would like a table chart to display today and yesterday data only, for which i used advanced filtering by setting the filter to today and yesterday dates. However, I want to be able to open my report tomorrow and see charts use data from tomorrow and today respectively.
With advanced filtering the charts appear static, not dynamic.
It would be good if someone could explain how to write queries in Power BI on my tables.

You could either
1) modify your sql query to only return today and yesterday data
or
2) add a calculated boolean column, something along the lines of
"IsCurrent = IF(AND(DATEVALUE(Table1[Date])<=TODAY() , 1.0*(DATEVALUE(Table1[Date])-TODAY())<=2),True,False)"
Then filter by IsCurrent.

Using the SDK you can apply filter(s) dynamically to the report. This allows you to simulate the user filtering the report data to the current day and yesterday.
Your client app would compute the correct filter data values and apply it to the report. Using something like report.setFilters(filters)
See this related question for more information about filters:
Power BI Embed URL-multiple filters

Related

Group Dates in Google Sheet Filter

is there any way I can group dates of a report in Google Sheets?
The difficulty that comes along is that this is a report that updates automatically every 4 hours (Salesforce connector).
When I add a slicer/filter option it shows me all the individual dates, but it would be great if I could somehow group them in the filter/slicer option only - without making changes to the live report from Salesforce.
Here is an example (Tab: Meetings): https://docs.google.com/spreadsheets/d/1IVJECB6z7pNXl2xas6O6uixx7gZ5GY0wZaFkaad01dY/edit?usp=sharing
In the example I do not have a live report (obviously), but I am afraid creating a new column for date or even pivot table will be difficult as there will be new record lines added to the sheet through the salesforce connector as it updates automatically..

Azure Devops Dashboards - How to chart the trend of query results over time based on work item history?

I want to be able to generate a stacked bar chart based on the results of a query, for example the number of open bugs and open features. I would like to see the resulting number of open bugs vs features from that query over a time period, for example the last 30 days. Specifically the number of bugs vs features that were open on that particular day, regardless of their current status. Is there a way to do this using an existing out of the box widget? I believe it should be possible to figure out this information using the history. Alternatively, is it possible to simply store the totals from the query somewhere in devops and then chart it? Or would I need to write a script to export the query results via the api and then use something like the power bi widget to chart it?
Sure, you can set up a chart of the query about the bugs and features opened in the last 30 days.
To meet this demand, you can do like as the steps below:
Set up a query with the following filter clauses. Save this query to the Shared Queries folder.
Work Item Type In Bug,Feature
State = [Any]
Created Date >= #StartOfDay('-30d')
On the Charts tab of the new query, create a new chart for the query like as below.
After saving the chart, add this chart to a specified dashboard in the project.
After above steps, navigate to the specified dashboard in the project, you can see the chart on the dashboard.
[UPDATE]
According to your latest reply, you want to get the Bug and Feature that were open state in the last 30 days. For these work items, we can think they satisfy one of the following conditions:
The work items were closed in the last 30 days, no matter what date they were created.
The work items are still open state currently. They do not have the closed date yet.
So, set up the query like as below should be able to match these work items.
Work Item Type In Bug,Feature
And State = [Any]
And Closed Date >= #StartOfDay('-30d')
Or Closed Date =
Group the last two clauses.
Then create the chart for the query.
Maybe the stacked chart would go some way to answering your problem.
https://learn.microsoft.com/en-us/azure/devops/report/dashboards/charts?toc=%2Fazure%2Fdevops%2Fboards%2Ftoc.json&bc=%2Fazure%2Fdevops%2Fboards%2Fbreadcrumb%2Ftoc.json&view=azure-devops#add-a-trend-chart
That produces charts with date as the x axis which, I think, is what you're looking for.

Dynamic Reporting Day in Tableau Dashboard

I have been trying my hands on something in Tableau and finding it hard to implement. I have attached my sample workbook and the data source I am using from excel. The second tab in Excel shows the final dashboards I want to see as the end result; the first of which I have accomplished in Tableau using the desktop version.
There are 5 kinds of products for which the quality runs happen at different times. My goal is to return the 'Result' of the product based on the latest available 'Quality Run Time' which is 29th March 2018. I got to this part using two calculated fields below:
{FIXED [Product] : MAX([Quality Run Time])} as 'Max_Date'
IF [Quality Run Time] = [Max_Date] THEN [Result] END as 'Max_Result'
The result of this is in the workbook. The problem is I want a dynamic 'Reporting Period' filter for the user to be able to choose from available dates in the 'Quality Run Time.' For example if I wanted to run a report for 27th March 2018, based on the logic I should see the dashboard below (ex from Tab 2 in Excel). I am guessing my calculated fields need to be dynamic somehow and I have tried many different options but it hasn't worked yet.
Please pickup data source and workbook from here
Your logic doesn't work as expected.
You need to create a parameter with datatype DATE and then use that in filter.
I have changed the report and attached in the same link.
I have changed in Tableau version 10.5
Edit---------------------------------------------------
Updated with v10.4 in same link

PowerBi doesn't honour an SSAS OLAP cube date field

We have an SSAS OLAP cube, in production since long and perfectly tested by dozens of users, with a normal Time dimension (two hierarchies, Months and Weeks, but this is irrelevant).
The Time dimension key is a date field. On the data view it is defined as DataType: System.DataTime. On the dimension as Calendar -> Date, Usage: Key.
Using this date field on an Excel table accessing the OLAP cube is fully operational, it is a date and "Date filter" options are available as expected.
But trying to use this field on PowerBI defeated all our efforts! No way to have PowerBI interpret the field as a date, so no date filters are available. PowerBI thinks it's a text field and nothing we can think makes it change its behaviour.
We tested PowerBI with an external Excel and adding the SSAS OLAP dimension so to be able to modify the field format and oh surprise! the field is interpreted as text. Changing the format to date makes it work.
But there is no way to change the format for an SSAS OLAP cube when accessed directly as the primary (and only) source of data for the PowerBI repport.
Any idea how to define an SSAS OLAP date field so PowerBI understands it is a date?
Found it! One minute before getting mad forever I spotted the diference.
I was able to create two dimensions on the same cube, with the same field. One works, the other doesn't.
Define the date field as Order by Key and PowerBi treats it as a date.
Define the date field as Order by Name and PowerBi treats it as text.
I came across same situation. I don't know OP's calendar dimension properties, but his solution does not helped me.
In dimension design I used ValueColumn property
And in Power BI I saw a new field, that worked pretty nice with Slicer visual:
And Excel all remained the same:

Tableau comparison calculation between integer dates

I'm currently struggling with a calculation I'm trying to create in Tableau so any help you can provide would be great.
Basically I have a calculated field within Tableau called [ExampleCount] which is a count distinct based on a simple Yes/No condition.
I have this information displayed on two separate sheets in a dashboard, one filtered for the current activity month and one for the previous.
What I now need to do is have another sheet with the same calculation of [ExampleCount] but showing the difference between the current/previous months.
So: [ExampleCount (This Activity Month)] - [ExampleCount (Previous Activity Month)]
The Activity month is an integer value, currently ranging from 1 - 9.
I feel like this should be a simple calculation but I've tried several different methods and have been unable to come up with anything conclusive.
It would also be good if this could change periodically.
Kind Regards,
Plain_Lazy