Subtract value of one table from another in PowerBI - powerbi

I have the following data
Date Band Colour Amount
02/01/2020 0-50 Red 20
01/01/2020 51-100 Blue 18
03/01/2020 51-100 Red 14
01/01/2020 51-100 Red 18
02/01/2020 51-100 Red 16
02/01/2020 51-100 Blue 14
01/01/2020 0-50 Red 12
03/01/2020 51-100 Blue 20
01/01/2020 51-100 Red 12
02/01/2020 0-50 Blue 11
02/01/2020 0-50 Red 13
01/01/2020 0-50 Red 10
02/01/2020 51-100 Blue 17
01/01/2020 51-100 Blue 17
I want to produce two table and filter by date.
the first table create colour by band and sum the total. same as the second table. the challenge is to find the difference between table one and table two base on filtered date
the table below show all report without filtering
when I filter table 1 to 01/01/2020and table 2 to 02/01/2020
my expected output will be

Please check the attached .pbix file for your reference. It is difficult to explain the whole process and as a result I have attached the report file here. Check these following things from the report-
Two separate Date table for two different slicer
Created three measure
Interaction between Slicer and Metrix visuals.
Get the Report File Here

Related

Power BI Matrix Visual Showing Row of Blank Values Even Though Source Data Does Not Have Blanks

I have two tables one with data about franchise locations (Franchise Profile Info) and one with Award data. Each franchise location is given a certain number of awards they are allowed to give out per year. Each franchise location rolls up to a larger group depending on where in the country they are located. These tables are in a 1 to 1 relationship using Franchise ID. I am trying to create a matrix with the number of awards, total utilized, and percentage utilized rolled up to group with the ability to expand the groups and see individual locations. For some reason when I add the value fields a blank row is created. There are not any blank rows in either of the original tables so I'm not sure where this is coming from.
Franchise Profile Info table
ID
Franchise Name
Group
Street Address
City
State
164
Park's
West
12 Park Dr.
Los Angeles
CA
365
A & J
East
243 Whiteoak Rd
Stafford
VA
271
Otto's
South
89 Main St.
St. Augustine
FL
Award table
ID
Year
TotalAwards
Utilized
164
2022
16
12
365
2022
5
5
271
2022
22
17
This tables are in a relationship with a 1 to 1 match on ID
What I want the matrix to look like
Group
Total Awards
Utilized
%Awards Utilized
East
5
5
100%
West
16
12
75%
South
22
17
77%
Instead what I'm getting is this
Group
Total Awards
Utilized
%Awards Utilized
East
5
5
100%
West
16
12
75%
South
22
17
77%
0
0
0%
I can't for the life of me figure out where this row is coming from. I can add in the Group and Franchise name as rows but as soon as I add any of the value columns this blank row shows up.
You have a value on the many side that does not exist on the one side. You can read a full explanation here. https://www.sqlbi.com/articles/blank-row-in-dax/

Create buckets to locate months in power BI

I have a column in excel named Month which consists data like-
When you create a chart with E_no by month you will get something like this
This is what the column exactly means
(In Jan 765 people were hired
In jan-feb-Mar 2276 people were hired)
How the chart looks like
Jan. -----------765
Jan-feb-mar ---------------------- 2276
Sep-Oct. ---------- 10
Oct. -------- 2
(the dashes are basically the bars of a horizontal bar graph and Jan, jan-feb-Mar as my Y axis)
E no
Month
2038
feb-mar-jun
657
Sep-Oct
221
Jun
6507
Oct
876
Mar-Apr-May
17
Nov-Dec
615
Dec
Now what I want is to create buckets like June should fall under the category of feb-mar-jun , Dec should fall under the category of Nov-dec, Oct should fall under the category of sep-oct.
for eg -
From these
Jan. -----------765
Jan-feb-mar ---------------------- 2276
Sep-oct. ---------10
Oct ----2
My o/p should look like
Jan-feb-mar -------------------------------- 3041
Sep-Oct ------------- 12
I'm new to power bi so if anyone have any good method other than this what I have mention would really help me to to get rid of this.
Let me know if you have any doubt regarding my question
Thanks in advance

Excel - Drop down list within a formula

I am sure this is a easy formula but 1 am struggling, I have the following:
On tab 1 I want to enter a colour multiple times into column A using a drop down option, for example and I want to pull the how many information from a table on another sheet, so when I do my formula using xlookup (=XLOOKUP(A2,Sheet2!A2:A7,Sheet2!B2:B7)) it works for the top 4 options but not the rest. Can someone help? I ahve also tried the IF formula etc but with no success.
A B
Colours How Many
Black 17
Yellow 765
Purple 65
Orange 43
Red #N/A
Green #N/A
Purple #N/A
Orange #N/A
Sheet 2 table:
Colours How Many
Red 34
Black 17
Green 32
Yellow 765
Purple 65
Orange 43
I hope this make sense.
Thanks in advance
Wayne
I figured it out
=VLOOKUP(A2,Sheet2!$A$1:$B$7, 2, FALSE)

Power bi return non existing rows as 0 in a matrix

We have a dataset in which there is data for only several months. So for example January is in, March is in and June is in. Then a matrix is formed with the data.
january february march april may june july
345 452 657
So our data looks like this
Months value
january 345
march 452
june 657
We want to average the values in this matrix. So sum(values)/months. We have tried a lot with Power bi DAX but have not yet found the solution.
Now the average that comes out is the following
(345 + 452 + 657) / 3 = 484,6
While what we want is
(345 + 452 + 657) / 7 = 207,7
Matrix is specially designed to show only the column or row that has a value on it. It will not show null or no values on it.
But, if you Create a Measure and add + 0 to the Measure Formula then it should show the value. An Example would look like this
# Sales= DISTINCTCOUNT(tbl_SalesHistory[SaleID]) + 0

PowerBI How to compute Dynamic measure based on slicer selection?

Here I like to compute dynamic measure called "count_percent" (last field) based on slicer selection.
Formula for 'count_percent' is ...Admin/count
Slicers in PowerBI = Diag and Practice
Bar chart has Date on X column (1/1/2018 to 1/3/2018) and 'count_percent' on Y column
In this example,
if I select Diag slicer = Head and Practice = open or select all, I
like to see 'count_percent' for 1/1/2018, itshould be 6 (24/4)
if I select Diag slicer = Head and Practice slicer = Practice 1, i
like to see 'count_percent for 1/1/2018, it should be 5 (10/2)
if I select Diag = open and practice = 1, i like to see 'count_percent' for 1/1/2018 is 4.16 (25/6)
Please hlep. My data sample is below. Thank you so much
Date Diag Practice Admin count count_percent
01/01/2018 Head Practice1 10 2
01/02/2018 Head Practice1 22 3
01/03/2018 Head Practice1 13 3
01/01/2018 Head Practice2 14 2
01/02/2018 Head Practice2 13 2
01/01/2018 Neck Practice1 15 4
01/02/2018 Neck Practice1 17 2
01/03/2018 Neck Practice1 12 2
01/01/2018 Neck Practice2 18 3
01/02/2018 Neck Practice2 20 4
It should be as simple as this: count_percent = DIVIDE(SUM(admin), SUM(count))