Forum Discussion
How to keep X axis static after filtering
Hi All,
I currently have a set of data that records how people are feeling on a scale of 1 to 5.
That is being represented on a bar chart which counts how many 1s ,2s,3s e.t.c there are.
However, if i choose to filter the graph to a certain week, because there are certain weeks where there will not be any e.g. 1s then the x axis will not show it.
Is there a way to keepo the x axisi static so it shows 1 to 5?
I have tried the trick where you create a seperate table and then link it to the main table but that has not worked for me.
I have also tried turning on show items with no data, but because the bar chart shows both % and count; it does not work.
Does anyone have any solutions?
Thanks!
what i want
what it ends up looking
Hi, Anonymous
Based on your description, I created data to reproduce your scneario. The pbix file is attached in the end.
Table:
Feelings(a calculated Table):
Feelings = DISTINCT('Table'[Feeling])You may use the 'Feeling' column from the 'Feelings' table to display the result. Here is the measure to count distinct person.
Result = CALCULATE( DISTINCTCOUNT('Table'[People]), FILTER( ALLSELECTED('Table'), 'Table'[Feeling] = SELECTEDVALUE(Feelings[Feeling]) ) )+0Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 Replies
- Greg_Deckler
Community Champion
Perhaps try adding something like the following to your measure:
Measure =
VAR __MyVar = <some calculation>
RETURN
IF(ISBLANK(__MyVar),0,__MyVar)
Sometimes just returning 0 or something instead of blank can get things to show up.
If that doesn't work, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2. - amitchandak
Super User
Anonymous , use +0 in measure . or use this option
- AnonymousNot applicable
HI,
Unfortunately, this is not a measure and i have tried using the show items with no data option and it does not work
- v-alq-msft
Community Support
Hi, Anonymous
Based on your description, I created data to reproduce your scneario. The pbix file is attached in the end.
Table:
Feelings(a calculated Table):
Feelings = DISTINCT('Table'[Feeling])You may use the 'Feeling' column from the 'Feelings' table to display the result. Here is the measure to count distinct person.
Result = CALCULATE( DISTINCTCOUNT('Table'[People]), FILTER( ALLSELECTED('Table'), 'Table'[Feeling] = SELECTEDVALUE(Feelings[Feeling]) ) )+0Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.