How can I change not only the value of the custom field but the what the field shows itself?

I need to be able to write custom fields in Power BI but the values of the fields change based off of company. For example, Twitter vs Instagram - field 1 for Twitter should show company name and field 1 for Instagram should show company revenue. So not only does the field change but the value of the field changes too. I have an excel sheet that lists around 30 custom fields for 2 different companies so I was wondering …
Topic: powerbi
Category: Data Science

Are there any open datasets for commercial use?

I am creating a bootcamp for data analyst and it's been 2 days I am looking for some good dataset fit for commercial use that I can use to create Tableau and Power BI tutorials. Even on kaggle some datasets are licensed as CC0 but when you track back the company the data was scrapped from, it states that the data shouldn't be used for commercial use (e.g Zomato dataset). Are there any good data sources which I can use …
Category: Data Science

Reusing DAX variable in another calculation

I have: var calc = CALCULATE([AMeasure], [SomeProperty] = 1) Is it possible to extend this in another calculation without making calc a measure, i.e: var nextCalc = CALCULATE(calc, [SomeOtherProperty] = 2)
Topic: powerbi
Category: Data Science

Power BI: Add slicer from measure

I have a list of working hours by date for every employee at a company and I have created a measure to calculate the total working hours. In the report I used a date slider so that the user can see the working hours by period. I now would like to create another slider which filters the employees by their total working hours in the given period. Say in the visual I would like to see who worked between 80-90% …
Category: Data Science

Merge two data sets by date, filling in missing dates in 1st table, power bi

I'd like to merge the two data sets by the date, keeping all the dates and filling in the totals col with NULL when the date doesn't match EDIT: I’m working in Power BI Data set 1 dates A_totals 2015-07-09 1 2015-07-10 1 2015-07-12 2 2015-07-14 4 2015-07-16 0 Data set 2 dates B_totals 2015-07-09 2 2015-07-11 5 2015-07-13 6 2015-07-15 9 2015-07-17 1 Desired Output dates A_totals B_totals 2015-07-09 1 2 2015-07-10 1 null 2015-07-11 null 5 2015-07-12 2 …
Topic: powerbi
Category: Data Science

Working with two dates fields in table

I am working with dates. My fields are in order table: Start date close date order no. I have to show open orders each month. I have created a relationship with the date table by start date. I need to relations like: If the start date is in this month and before this month and the end date is this month means the order is closed in this month itself it should count 0 If the start date is in …
Topic: powerbi
Category: Data Science

PowerBI - apply single field filter to multiple datasets?

Full disclosure, I am a powerBI n00b. I am working on a report for data generated by an external system. This system exports data into different tabs in an excel sheet(lame, I know). I am needing to get a single filter to filter data from all 4 data sets. Let's say this column is "last name". I have tried to create these relationships, and it seems to work....however I am convinced this is not the proper way to handle this. …
Category: Data Science

How to only show the tooltip for a trace I am hovering over

I have a Line chart with multiple traces. When I hover over a tooltip, it shows every trace in the tooltip, not just the one I am hovering over. I have so many traces that the one I am hovering over is not even displayed in the tooltip since it's cutoff. How can I tell what trace I am hovering over? Setup: Date is 'Axis' Each trace (what I'm trying to find) is 'Legend' Amount is 'Values' Sorted by 'Date' …
Topic: powerbi
Category: Data Science

How to display quarterly data in Power BI

I have a Power BI report with a Date (slicer) visual like that. In a Data Model there is a tabel 'Date' that corresponds to this visual. At the moment there are only Day, Week, Month and Year dimensions in date selection options. But I would like to see that there is a Quarter option too. If I select all date options in 'Date' table then the Power BI doesn't add a Quater option to the previous list but constructs …
Topic: powerbi
Category: Data Science

How to use query parameters in PowerBI?

I'm fairly new using PowerBI. I need to create a report using a query like this: SELECT something FROM mytable WHERE (DescMedAcc LIKE @Param1 OR DescErog LIKE @Param1) AND .... I'm using PowerBI , directQuery then publish report on a PowerBI report server. Why can't use @Param1 ? What am I wrong ?
Topic: powerbi
Category: Data Science

Calculating % by Dividing Filtered Matrix Columns in MS Power BI

Given: A monthly percentage (%) metric has to be calculated from dividing a column ('Numerator') from one table by a column ('Denominator') from another table, both filtered by month, as given in an example below: Table 1: Date_1 Numerator 01-Jan-19 5 05-Feb-19 4 04-Apr-19 1 07-May-19 3 11-Jun-19 5 22-Jun-19 4 25-Jul-19 5 31-Aug-19 1 03-Sep-19 4 25-Oct-19 5 Table 2: Date_2 Denominator 03-Jan-19 7 05-Jan-19 9 16-Feb-19 8 22-Feb-19 7 04-Mar-19 10 18-Mar-19 8 24-Apr-19 8 25-Apr-19 8 01-May-19 …
Category: Data Science

Which visualization tool should I use?

We consider the below function : $f(x,y,z,a) = x*y*z*a$, where $x,y \in \mathbb{Q}\cap[0,1000],$ $ a\in\{2,3\} $ and $z=z(x)$, taking values from the below table based on the level-range that $x$ belongs to. For instance, if $x=150$, then $z=5.$ I am looking for the proper visualization tool that can produce all possible 2-dim and 3-dim graphs of the above function.\ For instance, if I fix $x=150$ and $a=2$, I want the 2-dim graph $(y,f(150,y,5,2))$ if I fix $a=2$, I want the …
Category: Data Science

Show overall average on plots of single data

I have data from a survey from multiple locations (1 data set per location per year, each containing about 20-25 numerical scores from 0 to 5). This data is aggregated over topics (e.g. first 5 questions are Topic 1, questions 6-10 are Topic 2) so I can calculate the average score per topic, per location, per year. I would like to show radar charts showing the values for one location and comparing it with the overall average; I thought about …
Topic: powerbi data
Category: Data Science

How come powerbi does not SUM() properly?

I want to learn PowerBI so I downloaded it connected PowerBI to a MySQL database that uses this test data set: http://learn.evermight.net/johnlai/demostore.sql That data set has the tables invoice,invoice_item,customer,address,product. I want to use PowerBI to give me a table of data that yields the same result as this query: SELECT customer_id, CONCAT(first_name,last_name), (SELECT SUM(qty*unit_cost) FROM invoice_item WHERE invoice_id IN (SELECT invoice_id FROM invoice WHERE invoice.customer_id = customer.customer_id)) AS PurchAmt FROM customer GROUP BY customer_id ORDER BY PurchAmt DESC; +-------------+------------------------------+-------------+ | …
Topic: powerbi
Category: Data Science

Help with breaking up a column in PowerBI to make a bar chart

My data set is a list of documents. I have a column in my data set - 'Independent Variable'. This column can contain nothing, i.e. 'NA', or one variable, i.e. 'var1', or multiple, i.e. 'var1;var2;var3' and is essentially metadata for the documents. I'm attempting to create a visual, like a bar chart, that would show how many documents in my data set are associated with each independent variable. I have roughly 30 independent variables, and they are all housed in …
Category: Data Science

Power BI : How to concactenate a variable number of columns?

I am importing data from Jira in PowerBi directly from the web. The data contains an unknown number of columns with similar name (for example Comment1, Comment2, Comment3, etc. depending on the maximum number of comments in the issues selected). I don't know how many of these columns will exist and this is variable. Is there a way I can concatenate all columns with the same name ? (so far, I found this general solution) Ideally I would like to …
Topic: powerbi
Category: Data Science

How to accomodate different database / schema names when writing M queries in Power BI?

I am working with Power BI and I need to setup a template with some input parameters, one of them being the name of the database to get data from. To do this, I have setup a parameter (called project_database) so that users can specify the database to be used in an Query via the Parameter Manager in Power Query Editor. I wrote a M Query that collects data from a database like so (with project_database being the input parameter): …
Topic: powerbi
Category: Data Science

How to read html tables under multiple headers and combine them in a single pandas dataframe?

I have an html file like this: <h1>Group 1</h1> <table> <tr> <td>Col1</td> <td>Col2</td> <td>Col3</td> </tr> <tr> <td>ValA</td> <td>ValB</td> <td>ValC</td> </tr> </table> <h1>Group 2</h1> <table> <tr> <td>Col1</td> <td>Col2</td> <td>Col3</td> </tr> <tr> <td>ValP</td> <td>ValQ</td> <td>ValR</td> </tr> </table> I want to read it into Pandas as if it had this structure: <table> <tr> <td>Caption</td> <td>Col1</td> <td>Col2</td> <td>Col3</td> </tr> <tr> <td>Group 1</td> <td>ValA</td> <td>ValB</td> <td>ValC</td> </tr> <tr> <td>Group 2</td> <td>ValP</td> <td>ValQ</td> <td>ValR</td> </tr> </table> I can do it easily with PowerQuery the language for …
Category: Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.