Forum Discussion
Not Displaying Values on Chart
Thanks for that.
Yes basically I will have a slicer to filter by dealer and another slicer to only show dates that cars went on sale that are within a chosen date range.
I then need to show a percentage of cars per month that we sold as this allows me to map basically which months have the highest percentage of car sales from the month advertised to get an idea of how long it takes on average for a sale to go through
Glad to help!
Did this solve your problem, or do you have further questions?
- Cmcmahan7 years agoResident Rockstar
In that case, you'll want to set it up to explicitly remove some filters, instead of using ALLSELECTED.
PercentageSold = COUNTROWS(DealerData)/CALCULATE(COUNTROWS(DealerData),ALLEXCEPT(DealerData, DealerData[Dealer], DealerData[Date Sale Started]) )
- Arranafc197 years agoHelper IV
Cmcmahan i am going to try apply this in the morning , and I will let you know if it worked for me. Very much appreciated
- Arranafc197 years agoHelper IV
Hi Cmcmahan ,
I tried your suggesiton and it didnt do the job I needed it to.
What I am trying to achieve , I believe is not overly complicated , however it is proving to be difficult through Power Bi.
I have the above dataset and what I am trying to do is , select one dealer and a daterange on the sale date and from this I would create a chart which shows the below.
"Of all the cars that went on sale between my chosen dates and for my chosen dealer , how many have sold in month 1 , month 2, month 3 etc."
If you have any further suggestions on how to approach this I would be greatful for the assistance as I am all out of ideas
- Cmcmahan7 years agoResident Rockstar
So I used the sample data you provided, and created this: https://drive.google.com/open?id=1LNknORx1-h5nSisltzL5DtBUSO9smL3O
It doesn't look particularly great, since I have a very small data set, but I think it displays the information you want with the options you want. Change up the visual as you see fit.
- Arranafc197 years agoHelper IV
Hi Cmcmahan
Thank you for the sample pbix file , very much appreciated.
I just had a look and it is very close to what I am looking far bar one issue.
The chart is showing a count of cars that have been sold by month where as I need to show the percentage.
For example , from the sample I provided , we have "O'Dwyers" , who between the date range , have 3 cars that went up for sale , with one selling in month 2. I need to show this as month 2 (33.3%) as only 1/3 of the cars sold that month.
For the "ABF Motors" , we had 4 cars go up for sale in that period, one sold in month 2 and the other in month 8.
I would need the grapth to show month 2 (25%) , month 8 (25%) and the other 50% would not be displayed on the report as these are not sold.
I am effectively trying to see from all the cars that went on sale between a particular time frame, what percetage sold in month 1 , month 2 , month 3 etc to see the highest percentage month it takes to sell
- Cmcmahan7 years agoResident Rockstar
Sure. So instead of a car count, you would want to use a measure like this:
PercentageSold = COUNTROWS(DealerData)/CALCULATE(COUNTROWS(DealerData),ALLSELECTED(DealerData))
Go to the Modeling tab, select this measure and format it as a percentage. Then you can use this as the field instead of the Count of MonthOfSale.
What's happening is that we're using COUNTROWS(DealerData) to count all the cars currently in context, with the context being a specific MonthOfSale from the column of the chart, as well as Dealer and Date filters.
Then it's dividing that by another count of rows, however I'm using CALCULATE syntax to change the context. ALLSELECTED is a cool pre-set filter context that returns all rows that are used in the current visual. The visual is trying to display all the data that respects your slicers, so this is an easy way to just count all of those rows quickly instead of mucking about with ALLEXCEPT or explicitly naming each field you want to keep in FILTER(ALL(table), field1=SELECTEDVALUE(field1)....) style syntax.
Hope this helps!
- Arranafc197 years agoHelper IV
hi Cmcmahan
Thanks again for your help , but this didnt work for me.
The measure you gave me calculated the percentages right including null , but as soon as I either apply a filter to exclude null or I add a slicer to filter it out , the percentage values changes as it is excluding the null (unsold) cars from the calulcation. I basically need the percetnages to be calculated using the null values , but for the null value percentage to not appear on the chart. Not sure where to go with this.