Been struggling with a problem and can't seem to get past it.
Trying to express the sample table below as Multi Info Cards.
Year
Description
Score
2018
Work Description One
25
2019
Work Description Two
21
2021
Work Description One
12
2019
Work Description Three
19
The cards need to display the description column based on the scores column. Currently row one and row three are combined due to having the same description, showing a sum value of 37.
The easiest way to differentiate would be based on the year but I am having trouble creating a measure/filter to achieve that.
Related
I am learning Power BI Desktop. I have a project already loaded for which I have created a
pie chart.
As you can see, the data is currently divided into two years: 2022 and 2021.
I also have data for previous years that I want to include in the chart. Unfortunately, none of these years has a high number. So I want to group them all into an "Other" category.
I've already tried using the RANKX function as described here (where I copied and pasted the formula from the comment and replaced the field name with my own) and here (where I went through the article step by step using my own field names). I used the exact format shown in both the comment and the article:
Rank = RANKX('Table','Table'[Percent],,DESC,Dense)
(Table is the table name I am using and Percent is the column I am trying to rank.)
When I added the new column to a table, though, PowerBI automatically gave me a sum calculation. This calculation gave me a 1 in each column. When I asked it not to give me a sum, it said it could not display the visual and took me back to the calculation screen.
EDIT: Thanks for your help Kevin! This is the table I tried to draw from. I am an idiot sometimes.
EDIT 2: Now I am trying to use a different field in the formula:
Rank = RANKX('FactClaimActivity','FactClaimActivity'[DirectIncurredLoss_ITD])
(This is the original field that I tried to base Percent on)
My table looks like this. (Yes, I know that 2016, 2017, 2019 and 2020 have negative values and 2014 and 2015 have $0 values. I just want to show what the data is.)
EDIT 3: This time I am also getting an error when I type in the formula, which says "A single value for column 'DirectIncurredLoss_ITD' in table 'FactClaimActivity' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result."
I do not understand why it wants a single result for a formula that ranks the data points based on this field. That seems like it defeats the whole purpose of the formula.
Yet when I use the formula, I get the same result as last time! This column is in the Fixed decimal number format, and it does have many different values.
EDIT: I've found the answer
New Category = IF('FactClaimActivity'[Rank]<=2,'FactClaimActivity'[LossYear],"Other")
The formula will help you get the correct result.
My backend table has the data at a week level. It contain the current ISO year and current ISO week, as well as, the previous year's ISO year and week number that the current year's data should be compared with.
For each signup_iso_year-signup_iso_week combination, there exists only one iso_prev_year-iso_prev_yearweek combination.
The iso_prev_year, iso_prev_yearweek columns account for the offset that might occur due to certain years having 53 weeks instead of 52.
data table
(I can't embed images, so I have added a table here as well, although it has much less information than the image in 'data table').
Number_of_signups
signup_iso_year
signup_iso_week
iso_prev_year
iso_prev_yearweek
Country
grade_level
5
2020
18
2019
18
IN
middle school
7
2020
18
2019
18
US
high school
6
2021
17
2018
18
IN
middle school
8
2021
17
2018
18
US
high school
I want to calculate to Year-Over_Year Change in number_of_signups using the signup_iso_year, signup_iso_week, iso_prev_year, iso_prev_yearweek columns.
I have already tried to create a calculated column that contains the sum of number_of_signups from previous year, but since every combination of country, grade_level, subject, email_type might not exist in previous or current year, some of the values are getting lost and hence giving incorrect results.
The answer I am looking for, is a Power BI measure that can give me the YOY change based on signup_iso_year and signup_iso_week.
Edit: I should have mentioned this before, but I forgot. The table contains data from 2018 to current day. So, the data size is quite large. Also, I need this YoY measure for a time series visual, which means that I can't assign ISOyear/ISOweek values for previous year using simple MAX/MIN functions. It needs to pick values from the iso_prev_year, iso_prev_yearweek columns but since EARLIER function can't be used in a measure, I am not able to figure out how to do that.
Which is why I had tried to create a calculated column, and use the EARLIER function to compute previous year's number_of_signups. But because of the other columns present in the data, i.e., country, grade_level, subject, email_type, there were discrepancies occurring in the actual number_of_signups and the calculated previous_year_number_of_signups. These discrepancies were due to the fact that not every combination of these columns exists for each week, so we might miss out on some data when calculating previous_year_number_of_signups.
Edit 2: Was asked to include examples of what the expected result would look like, so adding some pictures.
YoY at overall level, country level, grade level
YOY at country+grade level
If I understand your requirement correct, you need a Measure like below. Remember, this may not the exact one you need, but this will definitely help you to reach your required output.
prev_signup =
var iso_prev_year = MIN(your_table_name[iso_prev_year])
var iso_prev_year_week = MIN(your_table_name[iso_prev_yearweek])
RETURN
CALCULATE(
SUM(your_table_name[Number_of_signups]),
FILTER(
ALL(your_table_name),
your_table_name[signup_iso_year] = iso_prev_year
&& your_table_name[signup_iso_week] = iso_prev_year_week
)
) + 0
You can also do some transformation in Power Query Editor and join the same table using your Key columns. That case, you can bring previous year's value in the same row. Rest is just compare 2 columns from your table to calculate YOY
I have done almost everything but not able to achieve the desired solution.
I have two surveys for 2020 and 2021 which have multiple-choice questions.
So there are two tables:
Table 1
Table 2
Since it's a multiple-choice question, I want to calculate the percentage of respondents who chose e.g. western Europe as an attractive region based on total number of respondents for a survey. For this, I have linked the above two charts using Survey ID.
I want a measure to calculate the last column in below table 3:
Table 3
For eg. for Western Europe, 3 respondents in 2021 survey have marked it as a attractive region. Now the percentage I want is 3 divided by 4 (respondents in 2021 survey). The percentage I am getting is 3/9 (respondents in 2020+2021 survey)
This is the DAX I am using:
Denominator = calculate(sum('Table 2'[Weightage]),allexcept('Table 2',Table 2[Survey year]))
%category = divide(sum('Table 1'[Weightage]),Denominator,0)
Please suggest the change in DAX function to require desired percentage. Since its a multiple choice question I am facing issues. I really need this to be resolved, please suggest what can be done. Thankyou.
I have built a line chart using two filter conditions and want to include dynamic average line to the visual. Like for example I need to show the average line based on two parameters, first is date i.e. 21st Jan - 25 Jan and the site locations selected, it will only consider average between 21st to 25th Jan and not till 4th of Feb.
The site location will also be selected to count the call volume.
I am struggling to find a way around as I I thought of using SelectedValue or switch method.
Any help will be much appreciated.
i have a table, Partner Group is common from one excel file
then i have 4 more files with dates: dec '18, dec '19, jan '20. feb '20
the four excel files in powerbi are connected via the partner group file.
i have no idea how to get it to highlight the row based on high to low. i have tried many ways but it wont work