PowerBI display top 3 categories and values monthly - powerbi

I have a table with these columns:
Date, Category1, Category1 value, Category2, Cat2 value, Category 3, Cat 3 value.
Category 1,2, and 3 are text and values are numbers. Date is month. How can i display the categories and corresponding values for each month? I am thinking a column chart.

Related

How to plot maximum/minimum value plot for selected item's category

Table 1:
Date
Item
Sales Amont
10/01/2021
Apple
300
10/02/2022
Orange
700
20/03/2022
Carrot
300
21/03/2022
Onion
800
Table 2:
Date
Item
Category
Sales Amount
10/01/2021
Apple
Fruits
300
20/02/2022
Carrot
Vegetable
800
10/02/2022
Orange
Fruits
700
21/03/2022
Onion
Vegetable
200
Relationship: Table1[Item] and Table2[Item] are connect using Many to many relationship.
Im trying to plot three lines of graph for table 1.
Line 1- Represents the maximum sale amount based on its category(category value retrieved from selected value of item displayed in slicer)
Line 2 – Represents the sale amount of selected item over the date.
Line 3 -- Represents the minimum sale amount based on its category(category value retrieved from selected value of item displayed in slicer)
My Problem is
Unable to plot the maximum/minimum sale amount line based on the slicer item category.
When you change the item in the slicer, the maximum/minimum line chart must be updated based on the selected item category, but in this case, the lines change based on the selected item value rather than the max/min value.
My Question is:
How to plot the maximum/minimum value chart only based selected item’s category.
Example :
If I choose the apple in the slicer, the maximum/minimum plot will show the maximum and minimum value of the fruits category.
Based on your comment I've given it a try.
First, I've modified the model to be closer to a typical PowerBI model. It makes everything much easier. Namely:
I've converted Table2 into a Category table.
I've created a Calendar table.
The new Category table looks like that:
Item
Category
Apple
Fruits
Carrot
Vegetable
Orange
Fruits
Onion
Vegetable
The calendar table is just a table expression:
Calendar = CALENDAR(DATE(2022, 01, 01), DATE(2022, 03, 31))
I end up with a model looking like this:
Then, regarding your calculations:
Line 1- Represents the maximum sale amount based on its category(category value retrieved from selected value of item displayed in slicer)
Cat_MaxSalesAmount =
MAXX(
Sales,
Sales[Sales Amont]
)
Line 2 – Represents the sale amount of selected item over the date.
Sales_AllCategories =
CALCULATE(
SUM(Sales[Sales Amont]),
ALL(Category[Category])
)
Line 3 -- Represents the minimum sale amount based on its category(category value retrieved from selected value of item displayed in slicer)
Cat_MinSalesAmount =
MINX(
Sales,
Sales[Sales Amont]
)
I've tried it in table visualisation and the different calculations are modified by the filters.

DAX to calculate no of days between 2 dynamic dates

I have 2 date column in my table ie entrydate and exitdate and also containerno column and 1 seperate date table in power bi.
Now the case is -
I have 1 date slicer in report.
Need to count no of days in monthly basis.
Eg if my container enter in 20-nov-2020 and exitdate is 5-Dec-2020
So when we select 26-nov-2020 in my date slicer then
Required output is 6 days.
Means then my selected date will become my exitdate.
And when we select 1-dec-2020 to 10-dec-2020 then
Output is 5 days
So my entry and exit date can be dynamic based on selected date by comparing with entrydate and exitdate

Power BI How to Sum Matched 2 Columns

I have two tables. First one represents sales values of company by department, product ID and month. Second table contains sales target by department and month. I want to add a column to second table. It should shows sum of values from table 1 with grouping department and month.
For Example:
For 310101 in Februray sum of values is 110. So, the first row of table 2 should be 110.
Can you please help me with this DAX function?
Create a calculated column in both tables which will represent an unique ID (Eg: ID = Table1[Dpt ID] & Table1[Month]) and join the both tables by this ID field to create a relationship between these 2 tables.
Now, select all the columns from Table 2 and also select Value column from Table 1. You should get the sum by department.

Date range filter in clustered column chart

In my Power BI report I have a date slicer and a clustered column chart. In the chart I want to display how much events occurred per hour. For that I have a data table like this:
Date Hour Count
01.01.2019 07:00:00 4
01.01.2019 09:00:00 9
03.01.2019 07:00:00 1
07.01.2019 10:00:00 14
and so on ...
The charts x-axis displays the hour, y-axis the count.
Now I want to be able to filter the chart by date when I change the date range in the slicer. For example when I set the slicer to the range from 04.01.2019 to 10.01.2019, the chart should display the hour histogram only of these 7 days.
Hope you have an idea what I want to do.
Thanks in advance!
EDIT
I've found out why it is not working. The report contains multiple charts, each bound to an own data table. Each table has a date column. The slicer uses one of these date columns, but not the one of the data used by the clustered column chart. Now the date column of the clustered column chart can contain one date multiple times. But the date column which is used by the slicer contains each date only once.
The data table used by the slicer looks like this:
Date some other columns
01.01.2019 ...
02.01.2019 ...
04.01.2019 ...
...
Each date is contained once at the most in contrast to the date column of the first table, where each date can appear more than once. Because of this the slicer works for the one chart but not for the other.
Ok, found the solution and it is very easy. All you have to do is to create a relationship between the date column of table two and the date colum of table one. The slicer uses the date column of table two. If you change the date range now this affects the clustered column chart too.

spotfire - Compare rows based on date - see description

I have rows of data based on dates and employee details.
For eg, I have date column, employee ID and Prokect ID. The data is from january 1st to january 22nd.
I want to compare each dates data and see if there is any change in the employees ID for the next date.
If i have 200 employees on january 1 and 203 employees on january 2,  I need to show the difference as 3 in the new column.
How can i do the row comparison and do this calculation?