'OR' Filtering on Columns in PowerBI - powerbi

I've got an oddly set up google sheet as my data source for a powerBI dashboard. Right now my main stress point is a 'last 7 days' filter that needs to be applied. The problem is that there are multiple columns containing dates that could be in the last 7 days, in this case representing multiple steps in an email chain.
If any one of those columns contains a date in the last 7 days, then I need to capture the row in most of my visualizations and tables, but if I just use standard filters, PowerBI assumes 'AND' and displays none of the rows, since there will almost never be a row where multiple date entries are in the last 7 days.
I'm almost certain there is a way to do this with either merged columns or calculated fields, or maybe there is even something as simple as an 'OR' filter, but thus far my googling has not turned up anything. Do you know a work around for this?
Thanks in advance!

In Power Query Editor, create a duplicate column for each of your date fields.
Make sure each of the duplicated columns is in Date format and then calculate the "Age". You will get a time value. In the Transform pane, use the "Duration" function and convert to "Days". Do this for each of the duplicated columns.
Now the last step: Create a "conditional column" in the "Add column" pane, and pull all of these new columns that should now have integer values and set the condition to show "Yes" if less than or equal to 7, "No" if more than 7.
Let me know if this helps.

Related

how to set current quarter in Superset?

I want to set current quarter dynamically, e.g [2021-01-01 ~ 2021-04-01)
Does superset support it? if so how to config it?
The Last vs Previous and date range control in general has been a source of confusion for my users.
Last Quarter just shows the last 3 months [because it's a quarter of a year?].
It would be great to have options like Week to date, Month/Period to date, Quarter to date, etc...
Another issue is that each company may define their quarters/periods on different starting dates, depending on their fiscal calendar.
As a stop-gap, I've done the following.
enriched the underlying dataset to have additional columns like period_start_date and fiscal_quarter_start_date.
created a fiscal_dates table that contains a list of every day over the years I need to query. The columns correlate with date columns in my other tables, like dob, fiscal_week_start_date, period_start_date, fiscal_quarter_start_date . I created this table in postgres using generate series
created a new virtual dataset that contains the column period_start_date, that shows the last 4 years of period start dates.
use a value native filter to select from the list of dates.
make the values sorted descending, and default value as "first item in list".
This allows the user to select all records that occur in the same quarter/period, with a default of the current quarter.
The tentative apache/superset#17416 pull request should remedy this problem, i.e., for the QTD you would simply specify the START as datetrunc(datetime("now"), quarter) and leave the END undefined.

Power BI Table w/ Slicer Where Other Columns Adjust Parameters Based Off Selection

I have the following Power BI table example for an operating expense report that uses a slicer to filter the first column named "Actual". This is to see the operating expenses for one month compared to the budget figures for the year. It also compares the year-to-date and annual figures. How can I create dynamic columns that change based on the slicer selection? These additional columns are not shown in the pic below but included in the last pic. The Budget column below was just created as an example to show what it should look like.
I set up a star schema with several tables shown below. There's only one expense fact table used and the slicer only works for the first column as previously stated but I need all the other columns to use different parameters and adjust based off what's selected in the slicer. The last image is an overview of the info and the parameters for each column. I tried creating new columns with measures for the budget to see if I can get that going but can't figure out how to make it adjust with the slicer selection.
I'm not sure if I should be using separate queries for each column or can this be done using the one expense table. Hope this isn't too confusing. Please let me know if more info is needed.
If I understood what you wanted correctly I think I solved your problem.
I was able to create the following:
I did not use all values since I did not want to type everything, if you provide some test data it is easier to replicate you dashboard.
This matrix (so not table) allows you to filter for Date (if you so desire, you can always show all date's in the matrix) Book and AccountTree.
The way this is done is by putting the address column in the ROWS for the matrix, Putting the Date column in the COLUMNS of the matrix and putting your values (actual, budget, variance) in the values of the matrix.
For the date is used days, since it was easier to type. You can always use weeks, months, quarters or years.
For this to work you have to create the following relationships:
Hope this helps.
If not, please provide test data so it is easier to try and solve your problem.

How to perform comparison in Power BI?

I have two tables in Power BI - each has the exact same columns, however, one is from the past 7 days, and the other is from the 7 days before that. I simply want to be able to compare the data week-over-week, but am struggling to get it to work.
For example, a column used is "Source." It lists the source used for each row. I tried creating a clustered column chart and putting the "Count of Source" fields from each table in "Value" and then "Source" in "Axis." When I do this, it accurately displays the columns for one table, but the other tables' values are all messed up - it just shows the sum.
See image :

Merge or combine two columns in power bi

I am not sure if my title is correct one, but here is the deal:
I want to make a matrix visualization in Power Bi Desktop. I have fields: ARTICLE_ID and ARTICLE_NAME.
I would like to have both those fields in COLUMNS position in matrix data view. And I need them to be in one row, no need to drill down... because it is one and the same thing...
I need to have ARTICLE_ID and ARTICLE_NAME as two separate columns on the same level. without drilling. And also, I dont want to use concatenation or merging into some third column. is that possible? thanks
1) I started with this sample data.
2) I created a matrix and configured it as shown in the image below.
3) I clicked the forked arrows to show all levels.
4) In the Rows section of the formatting pane, I turned off "Stepped layout".
5) In the Subtotals section, I turned off "Row subtotals".
I don't know if this is exactly what you are looking for, but I think it is the closest I can come up with since you don't want to concatenate the columns together.
If they are from the same table then just drag and drop them into the columns.
The way a matrix works from my understanding in PowerBI is;
Rows are just the headings/categories of the values.
You might need to also go into the format tab, values, and make sure show on rows is on.
For example, let's say our value headings are rainy days and sunny days.
Your columns are months.
The rows will be the 2 categories.
The values will be the values.
As concatenation and "&" does not work in Power BI directquery you can use the below one:
[New_column_name] = if((table_name[column_name]="A" && table_name[column_name]="B"),"AB","NA")
Thanks,
Sachin Kashyap

Creating Date Relationship in Power BI for Slicers

I'd like to slice across visuals based on dates in MS Power BI (i.e., one filter for say month will slice all visuals for that time period.
I created a date table from http://www.agilebi.com.au/power-bi-date-dimension/ to link to the date columns in each table.
I connected xlsx workbook.
Image of columns in Power BI
I added tried to edit the relationship so connect the 2 date columns. However, when I insert the filter using the date_table as values and try to use it, the visuals disappear.
Visuals are Gone
However, when I create the slicer and slice across multiple visuals, they go blank.
**I tried changing the type to "Both" but it didn't fix the problem.
The script at AgileBI.com.au creates a date table with a 'Date' field that has a data type of text. You can (surprisingly) do a relationship between 2 fields of different data types and not get an error. However, a join between a text field that contains dates, and a regular date field will mean that rows that look like they should match up do not.
You can confirm this is happening by picking a value in the 2 tables that you think should match up and seeing if they are identical. In my case, I had Tuesday, November 01, 2016 in my imported table, and 11/1/2016 in the other table. While they both represent the same date (in the US), they clearly look different. A good place to see this is in the Edit Relationship screen (and it definitely would have been helpful to include a screenshot of that in your original post).
Anyway, if the dates in your table don't match up to the corresponding (text) dates in the Date table, then when you filter to "2016" on your slicer, the visuals will all go blank.
I would recommend:
Click Edit Queries
On the left hand side, select the table of dates (called Invoked Function by the script)
Click on the header for the Date column (it will likely already be selected)
Select Transform on the ribbon
Change the Data Type from Any to Date
Click Home > Close & Apply
Hope this helps.