Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
ExcelMonke
Responsive Resident
Responsive Resident

Show All Categories on X Axis

Hello, 
I am currently building two bar charts and I need some help with X-Axis formatting. 

The problem:

In Chart 1) I am looking at a sub-group's performance, their "time buckets" only go up to 60 minutes.

In Chart 2) I am looking at the parent group performance, their "time buckets" go up to 240 minutes.

 

The desired solution: 
I want the X axis for both charts to be the same, to go up to 240 minutes. This means that Chart 1) will show the time bucket on the x axis, even if the value is 0.

 

Example Data:

 

VisitGroupSub-GroupTime Bucket
1AAb10
2AAb10
3AAb20
4AAb30
5AAb60
6AAc10
7AAc15
8AAc20
9AAc20
10AAc20
11AAc60
12AAc60
13AAc240
14AAc240

 

Desired Result:

Notice how the X-Axis in Chart 1 - which charts sub-group Ab - still show buckets 15 and 240, even if the value is 0

ExcelMonke_1-1707176042635.png

 

ExcelMonke_0-1707175789432.png

Thank you!

7 REPLIES 7
v-kaiyue-msft
Community Support
Community Support

Hi @ExcelMonke ,

Please follow these steps:

According to your description, I created the following metric for the subgroup "Ab", and by the last judgment, the count result of 0 can also be displayed in the chart.

 

Measure =

VAR _count = CALCULATE(COUNT('Table'[Time Bucket]),FILTER(ALL('Table'),'Table'[Sub-Group] = "Ab" && 'Table'[Time Bucket] = MAX('Table'[Time Bucket])))

RETURN

IF(_count = 0,0,_count)

 

The final result is shown below.

vkaiyuemsft_0-1707193594737.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for the reply! So i tried to simplify the dataset in the problem. In actuality, the "Group" column comes from a different table (LocationDimension), and is linked to the visit table through the SubGroup name. How would I update the measure accordingly? Also it seems like I can't put the measure in the Axis.

Daniel29195
Super User
Super User

@ExcelMonke 

 

im not sure. 

maybe you enable the show items with no data. 

 

if not, maybe sharing the file if possible so i can take a closer look . 

 

 

best regards,

Thanks, that is how I got it to work on Excel, but I have not been able to find a similar button/option on Power BI. Any help finding it is also appreciated 🙂 

@ExcelMonke 

 

you just need to right click on the column name. ( or click on the arrow down ) 

Daniel29195_0-1707177183971.png

 

 

hope this helps . 

Hmmm, unfortunately that was not *quite* what I needed. It does show additional categories, however not at the level of the main group. For example, bucket 240 is still missing. 

@ExcelMonke 

if your calculations are returning 0 ,  then power bi will show the bucket. 

in order to know show the buckets where  that are equal to zero ,

 

you need in your dax change zero to blank () .

 

exa : 

measure= 

switch( true () , sum(tbl_name[col_name])= 0 , blank() , sum(tbl_name[col_name])

 

let me know if this helps .

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.