I have a table with repeating values in a single column, I am trying to filter the data corresponding to just one value. I have tried Pivoting the table and it didn't help, it would be helpful to get the solution using DAX or Power Query.
S.No.
Make
Sale Date
1
Mercedes
01.08.2020
2
BMW
02.08.2020
3
Hyundai
03.09.2020
4
Honda
04.06.2020
5
BMW
16.03.2020
6
BMW
06.08.2020
7
Mercedes
01.02.2021
8
Honda
18.08.2020
9
BMW
12.04.2020
10
Honda
10.03.2021
I need each Make to display their own Sale Date's in their own column similar to the table below
BMW
02.08.2020
16.03.2020
06.08.2020
12.04.2020
Using your example data:
In the data editor, select the Make and Sale Date and Pivot the items
Ensure that the 'Values Column' is 'Sale Date' and that the aggregate value is set to 'Don't Aggregate'
Which will give you a table with each make in its own column, and the dates of the sale
Related
This FEELS like something that can be done but I am at a loss for how to do it.
I have a table that has applicants for jobs...
name, requisition id, division, date applied, date hired
Each row is an applicant. Obviously not all applicants are hired. So in every row all fields are filled out with the exception of date hired for applicants that have not been hired.
I have slicers for month/quarter/year and division.
The date slicers all key off a field in every table called data_as_of which is the last day of the month with a one-to-many relationship with a date dimension table.
Here is a sample table...
[1]
[1]: https://i.stack.imgur.com/XQO9d.png
So here is what I'd like to do.
I'd like to slice by year and show a visual of all people hired in that year. Same with Quarter and Month (ie count all people in that quarter or month as appropriate). So far so good. That's easy.
Now on the same report page I'd like to show a visual (assume bar charts) that shows me a count of all the people that applied to the same requisition id prior to the date hired of whomever was hired in that requisition id.
Using the example above...
All of these examples assume 2021.
So if I used the month slicer in December I'd get 2 hirees in HR, Diane and Mel. In the second visual I'd get 7 Applicants.
If I used the month slicer to show November I'd get two hirees - Rhys and Jody. The applicant visual would show me 8 applicants. All 6 from requisition id 4 and 2 from requisition id 2 because one applied after Rhys was hired.
Consequently if I sliced for April of 2021 I'd get 1 hiree - Remi. In the applicant visual I'd get 4 applicants who all applied prior to Remi's hire date (including Morgan who applied in March but wasn't hired until May).
Does that all make sense?
I very much appreciate your help.
Best regards,
~Don
I have two tables in Power BI as follows:
COUNTRIES
COD COUNTRY
1 BRAZIL
2 ARGENTINA
3 CHILE
4 BRASIL
5 COLOMBIA
6 ARGENTINA
7 URUGUAI
SALES
COD DATE
1 2021-01-02
2 2021-10-01
3 2019-09-04
1 2018-07-05
7 2019-04-10
There's a relationship between the two tables, on the COD column.
I need to count how many countries (column "COUNTRY" from the table "COUNTRIES") have a status CHURN. It's considered CHURN when their latest order from the table "SALES" is more than 180 days, using today as a reference.
I know that I need to group by the MAX date per country, do a DATEDIFF, and then do a COUNT. I've tried using ALL and SUMMARIZE, but I haven't found a way to solve this problem.
Are you able to add a calculated column to store the max sales date for each country in your COUNTRIES table? Either in Power BI or directly in your database. If so, here's one solution with 2 steps.
Create a MaxSalesDate column in your COUNTRIES table. DAX for a calculated column below:
MaxSalesDate =
VAR COD = COUNTRIES[COD]
RETURN MAXX(FILTER(SALES, SALES[COD] = COD), SALES[DATE])
Create a measure that counts the number of MaxSalesDate values that are older than 180 days old:
CountCHURN = COUNTX(COUNTRIES, IF(DATEDIFF(COUNTRIES[MaxSalesDate], TODAY(), Day) > 180, 1))
Hello Stack Overflow Community,
In the attached excel sheet image, there are 5 columns (cols B to F) that have arbitrary sales numbers for years 2016-2020. In the report there will be a year slicer of each of these years. I want to calculate the total sales depending on the selection in the year slicer. However, there are 15 columns towards the end which dictate whether a particular company should be included in the total sales calculation. Only if the column corresponding to the selection by the user is N, the value should be included in the total sales calculation.
Example: If the user selects 2016,2017 and 2018 in the year slicer, Power BI should look into the column Excluded 2016-2017-2018 and include/ exclude the sales numbers of the respective years and finally return a table as below
Year Sales (Total)
2016 393
2017 561
2018 580
There is two problem in your case : the first is to be able to calcule with the filter and I think it will be easier if you do this in Excel and the second problem is to use a filter on a combinaison of imput to select only one value.
For the fist problem you could probably do something like that :
=IF(H2="Y";F2;0) / =IF(I2="Y";G2;0) / =IF(J2="Y";G2+F2;0)
and use the power of excel to slide the formula to the bottom of your table
And the next step is to sum the entire column and pivot the table :
But for the selection of the right row with your slicer on date i can't find a solution maybe you need to build a slider for all combinaison : 2016 / 2017 and 2016-2017,...
I want to get a distinct count of Enquiries with Food and Drink in Power Bi. The way the database is structured is:
1 Enquiry could have multiple days, which have food and drink attached to them.
I want to try and calculate how many enquiries have food and drink attached so I need to do a distinct count on the enquiry id in the Enquiries table where a record exists in the food and drink table
The table structure is as follows:
Enquiry Table
EnquiryId
10
Enquiry Day Table
EnquiryDayID EnquiryId
5 10
6 10
Enquiry Day Food Drink Table
EnquiryDayFoodDrinkId EnquiryDayId
20 5
21 6
Basically I want the distinct count to only return 1 as there is only one distinct enquiry with food + Drink attached.
Here is the code in SQL which return the correct number. I want to get the same result in Power BI
select count (distinct(e.pkEnquiries))
from EnquiryDayFoodDrink edfd
inner join EnquiryDay ed
on ed.EnquiryDayId = edfd.EnquiryDayId
inner join Enquiries e
on ed.EnquiryId = e.pkEnquiries
I have two tables:
Table A, which indicates where my truck is for each day,
Date Truck Region
5/20/2018 1014 NY
5/21/2018 1014 NJ
and Table B (which contains when my truck inspection was done for each day). Sometimes there may be more than one inspection record, but I only need the last one by truck by day. As you can see, I added a rank column. Truck 1014 has two records for 5/20/2018, but the last one gets ranked as 1 (I will filter the table by 1).
Date Time Truck Rank
5/20/2018 5/20/18 9:00 AM 1014 2
5/20/2018 5/20/18 2:00 PM 1014 1
5/21/2018 5/21/18 2:50 PM 1014 1
I want to merge those two tables together. The reason I ask how to do it in the query editor is that, in the relationship view, you cannot create a relationship on two columns. For example, in my example, I want to join data by date and by truck number, which I cannot. What is the right direction for this situation?
In the query editor, you can use the Merge Queries button under the Home tab.
(You'll need to hold down the Ctrl key to select multiple columns.)
Once you've merged, just expand the columns from Table B that you want to bring over (e.g. Time and Rank). If you did not filter Rank = 1 before merging, you can include it when expanding and filter afterward.
Note that you can also use the LOOKUPVALUE DAX function outside of the query editor. As a new column on Table A:
Time = LOOKUPVALUE('Table B'[Time],
'Table B'[Date], [Date],
'Table B'[Truck], [Truck],
'Table B'[Rank], 1)