Data lookup based on measure - dynamic
I am looking for some help in creating a measure to figure out data based on a ranking measure.
I have attached my Power BI file showing my issues and formulae.
https://www.dropbox.com/s/s7xted6lhh38dpo/Test.pbix?dl=0
Essentially, I have few tables that have been mapped. Showing revenue achieved by each employee for each product. The employees are split into 3 Teams.
I want to be able to rank these teams based on various filters that can be selected from one of the visualisations. – I have created the measure to do this using the below formulae:
Rev Measure = SUM(Sales[Rev])
Team Rank = RANKX(ALLSELECTED(Org[Team]),CALCULATE([Rev Measure]))
Now I want to create 2 card visualisation that dynamically fills in the data based on the ranking. So one card would read:
Commentary 1 = "Overall Sales was at $"& [Rev Measure] &". With the best performing Team being Team C bringing in $1220 of Revenue"
In the above commentary I am able to dynamically input the total revenue. However, I am unsure how to proceed with showing the best performing team data.
In the second card visualisation I want to show the worst performing team.
Any help on this would be greatly appreciated.
Thanks!
Related
How to populate all possible combination of values in columns, using Spark/normal SQL
I have a scenario, where my original dataset looks like below Data: Country,Commodity,Year,Type,Amount US,Vegetable,2010,Harvested,2.44 US,Vegetable,2010,Yield,15.8 US,Vegetable,2010,Production,6.48 US,Vegetable,2011,Harvested,6 US,Vegetable,2011,Yield,18 US,Vegetable,2011,Production,3 Argentina,Vegetable,2010,Harvested,15.2 Argentina,Vegetable,2010,Yield,40.5 Argentina,Vegetable,2010,Production,2.66 Argentina,Vegetable,2011,Harvested,15.2 Argentina,Vegetable,2011,Yield,40.5 Argentina,Vegetable,2011,Production,2.66 Bhutan,Vegetable,2010,Harvested,7 Bhutan,Vegetable,2010,Yield,35 Bhutan,Vegetable,2010,Production,5 Bhutan,Vegetable,2011,Harvested,2 Bhutan,Vegetable,2011,Yield,6 Bhutan,Vegetable,2011,Production,3 Image of the above csv: Now there is a very small country lookup table which has all possible countries the source data can come with, listed. PFB: I want to have the output data's number of columns always fixed (this is to ensure the reporting/visualization tool doesn't get dynamic number columns with every day's new source data ingestions depending on the varying distinct number of countries present). So, I've to somehow join the source data with the country_lookup csv and populate all those columns with default value as F. Every country column would be binary with T or F being the possible values. The original dataset from the above has to be converted into below: Data (I've kept the Amount field unsolved for column Type having Derived Yield as is, rather than calculating them below for a better understanding and for you to match with the formulae): Country,Commodity,Year,Type,Amount,US,Argentina,Bhutan,India,Nepal,Bangladesh US,Vegetable,2010,Harvested,2.44,T,F,F,F,F,F US,Vegetable,2010,Yield,15.8,T,F,F,F,F,F US,Vegetable,2010,Production,6.48,T,F,F,F,F,F US,Vegetable,2010,Derived Yield,(2.44+15.2)/(6.48+2.66),T,T,F,F,F,F US,Vegetable,2010,Derived Yield,(2.44+7)/(6.48+5),T,F,T,F,F,F US,Vegetable,2010,Derived Yield,(2.44+15.2+7)/(6.48+2.66+5),T,T,T,F,F,F US,Vegetable,2011,Harvested,6,T,F,F,F,F,F US,Vegetable,2011,Yield,18,T,F,F,F,F,F US,Vegetable,2011,Production,3,T,F,F,F,F,F US,Vegetable,2011,Derived Yield,(6+10)/(3+9),T,T,F,F,F,F US,Vegetable,2011,Derived Yield,(6+2)/(3+3),T,F,T,F,F,F US,Vegetable,2011,Derived Yield,(6+10+2)/(3+9+3),T,T,T,F,F,F Argentina,Vegetable,2010,Harvested,15.2,F,T,F,F,F,F Argentina,Vegetable,2010,Yield,40.5,F,T,F,F,F,F Argentina,Vegetable,2010,Production,2.66,F,T,F,F,F,F Argentina,Vegetable,2010,Derived Yield,(2.44+15.2)/(6.48+2.66),T,T,F,F,F,F Argentina,Vegetable,2010,Derived Yield,(15.2+7)/(2.66+5),F,T,T,F,F,F Argentina,Vegetable,2010,Derived Yield,(2.44+15.2+7)/(6.48+2.66+5),T,T,T,F,F,F Argentina,Vegetable,2011,Harvested,10,F,T,F,F,F,F Argentina,Vegetable,2011,Yield,90,F,T,F,F,F,F Argentina,Vegetable,2011,Production,9,F,T,F,F,F,F Argentina,Vegetable,2011,Derived Yield,(6+10)/(3+9),T,T,F,F,F,F Argentina,Vegetable,2011,Derived Yield,(10+2)/(9+3),F,T,T,F,F,F Argentina,Vegetable,2011,Derived Yield,(6+10+2)/(3+9+3),T,T,T,F,F,F Bhutan,Vegetable,2010,Harvested,7,F,F,T,F,F,F Bhutan,Vegetable,2010,Yield,35,F,F,T,F,F,F Bhutan,Vegetable,2010,Production,5,F,F,T,F,F,F Bhutan,Vegetable,2010,Derived Yield,(2.44+7)/(6.48+5),T,F,T,F,F,F Bhutan,Vegetable,2010,Derived Yield,(15.2+7)/(2.66+5),F,T,T,F,F,F Bhutan,Vegetable,2010,Derived Yield,(2.44+15.2+7)/(6.48+2.66+5),T,T,T,F,F,F Bhutan,Vegetable,2011,Harvested,2,F,F,T,F,F,F Bhutan,Vegetable,2011,Yield,6,F,F,T,F,F,F Bhutan,Vegetable,2011,Production,3,F,F,T,F,F,F Bhutan,Vegetable,2011,Derived Yield,(2.44+7)/(6.48+5),T,F,T,F,F,F Bhutan,Vegetable,2011,Derived Yield,(10+2)/(9+3),F,T,T,F,F,F Bhutan,Vegetable,2011,Derived Yield,(6+10+2)/(3+9+3),T,T,T,F,F,F The image of the above expected output data for a structured look at it: Part 1 - Part 2 - Formulae for populating Amount Field for Derived Type: Derived Amount = Sum of Harvested of all countries with T (True) grouped by Year and Commodity columns divided by Sum of Production of all countries with T (True)grouped by Year and Commodity columns. So, the target is to have a combination of all the countries from source and calculate the sum of respective Harvested and Production values which then has to be divided. The commodity can be more than one in the actual scenario for any given country, but that should not bother as the summation of amount happens on grouped commodity and year. Note: The users in the frontend can select any combination of countries. The sole purpose of doing it in the backend rather than dynamically doing it in the frontend is because AWS QuickSight (our visualisation tool), even though can populate sum on selected column filters but doesn't yet support calculation on those derived summed fields. Hence, the entire calculation of all combination of countries has to be pre-populated (very naive approach) in order to make it available in report on dynamic users selection of countries. Also if you've any better approach (than the above naive approach mentioned in note) to solve this problem, you are most welcome to guide me. I've also posted a question on the same problem without writing my expected approach for experts to show me the path on how we can solve this kind of a problem better than this naive approach. If you want to help solve it with some other technique, you're most welcome, here is the link to that question. Any help shall be greatly acknowledged.
Wrong SUM calculations in OLAP cube
I'm pretty new to SSAS and i have encountered a quite odd issue. The simple SUM function in OLAP cube shows wrong numbers based on the dimension usage. I have created simple OLAP cube in SSAS, which tracks fuel payments across company car fleet. Data source is a SQL database server, and I use table "purchase" (contains information of amount of fuel bought, paid price, location of purchase etc.) as a measure and tables "car" (information about car type, its registration ID etc.), "location" (plant location the driver originates from) and "division" as dimensions. When I first connected all dimensions to the measure on the "Dimension usage" tab, I got wrong sum of the price paid and amount of fuel bought - the sum displayed was much lower than the actual one. I tried to look into it and the numbers were wrong as well if i looked at the data by division, location etc. But when I used the "Car" dimension and created table showing the data for each individual car, the results were correct, which I find weird. When I disconnected the "Car" dimension from the measure group, the totals in the cube were correct, but i was (of course) unable to look at individual numbers for each car. I understand that there is some problem with the "Car" dimension, but I am unable to find out what exactly goes wrong. Any advice helping me to identify where to look would be much appreciated. Thanks in advance.
Tableau - Adding dimensions together to show overall revenue
I am very new to Tableau (first day user) and have been a long time Excel user. I am trying to fully understand the power of Tableau to eventually move away from Excel. I have a question concerning dimensions and creating a calculated field. My table has multiple categories and sub-categories. My goal is to display the total revenue and average order value per chosen sub-category (this seems easy enough). I want to then take those sub-categories and show a combined sum of revenue and average of the average order value. I am stuck on trying to also combine these sub-categories to show a blended view. Furthermore, the 2 sub-categories are weighted very differently. The average order value of 1 has a much heavier weight than the other and will definitely affect the AOV when combined. How do you also assign a weight to this combined total? Any help will be much appreciated. I know this may be a rather simple solution but I am new to the program and am having difficulty finding this answer. Tableau screen: or img1 http://postimg.org/image/dq5wqgnyl/ Best, CR
Put sub categories in the rows column. Put sum revenue in the text pill in the marks section In the analysis tab on the top select column grand totals. I'm unable to see your images,i hope this answers a apart of your question.
MDX filter on fixed value depending on hierarcy level
I need to build a named set with mdx which tells me for a whole year what which are the large records. I cannot share my data, so I'll use a sales example. All sales reps. need to enter their sales numbers in a application and on top of that database there is a cube configured. One of the goals is to find weird sales behaviour in this cube. This would mean a sales rep that is selling 100k every year, suddenly only sells 30k a year. I have created a dynamic set that allows me to filter on this by using a calculated member named 'qualifies'. This qualifies is defined like this. (Diff is calculated before) CREATE MEMBER Currentcube.qualifies AS iif(abs([Diff]) > 50000, 1, NULL),DISPLAY_FOLDER = 'Check big difference'; So this check can be used to filter all the sales reps that have a difference of 50k sales. When I add aonther filter to my cube, for example region, the 50k threshold will never be exceeded, because no body has more than 50k sales in one region. I want to make the 50K dynamic based on my where clause in my filter. My question is, is this possible? I'm fairly new to MDX so if this is an easy question, please forgive me. I have been trying lots of different scenario's but none gave a wanted result. I have been looking online, but this specific scenario hasn't passed in my search results.
display always the right MDX (sub)total in the client-application (eg Excel)
I can't figure it out! (CustomRollUpColumn??, or some custom made MDX calculated thing) My problem: I have a dimension TypeOfRow who's function it is to display the ... well yes ... type of row. I'm working in the financial sector and, always, need to provide the ultimate result ==>> The Total Contribution. I read, amongst others, the article of Martin Mason ( http://martinmason.wordpress.com/2012/02/26/the-ssas-financial-cubepart-1ragged-hierarchies/ ) and designed the dimension as a "Naturalized Parent-Child Hierarchy". The dimension, 5 levels, I designed for this solution is (simplyfied): •+/+ Revenue (several types of) •-/- Cost (several types of) •= Total Contribution A user requirement is that the "Total Contribution" always display the "Total Contribution" even if any the Revenue- or Cost types are filtered out. My question: is this possible showing the total of a dimension without showing all the members (in Excel but I hope to configure this in SSAS 2008R2)? many thanks in advance, - Leon