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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
BIanon
Resolver I
Resolver I

Identical axis label is repeated many times in visual

Hello Community,

I created a grouping based on the price of a good to be used on the axis of different visuals.

I created the groups by writing a SWITCH(TRUE()) statement because I want the group name to be the range and not just the first number in the range.
Here is my DAX:

SWITCH(
    TRUE(),
    'Table'[Item Price] <= 0,	 "<= 0 kr",
    'Table'[Item Price] < 10,	 "0-9 kr",
    'Table'[Item Price] < 20,	 "10-19 kr",
...
)


But when I apply this column in a visual, the labels are not grouped but is rather being read as different labels:

BIanon_0-1678115758671.png


In 'Data view' when filtering, the value is recognized as being the same value.
I tried filtering the table on the same value I selected in the above screenshot and it is counted as a single distinct value:

BIanon_1-1678115888943.png

 



1 ACCEPTED SOLUTION
BIanon
Resolver I
Resolver I

Still not sure what has caused this but I ended up tweaking the underlying DAX behind bins for my purpose:

VAR _RDown = ROUNDDOWN( 'Table'[Item Price] / 10, 0 ) * 10
VAR _RUp = ROUNDUP( 'Table'[Item Price] / 10, 0 ) * 10
VAR _RUpCheck = IF(_RDown = _RUp, _RUp + 10, _RUp)

RETURN
IF(
    ISBLANK( 'Table'[Item Price] ),
    "N/A",
    IF( 'Table'[Item Price] < 0, "N/A",
        IF(
            'Purchase'[Item Price] >= 0,
            CONCATENATE(
                _RDown,
                CONCATENATE( "-",
                    _RUpCheck
                )
            )
        )
    )
)

 
Seems to work allright but I'm still testing tho.

View solution in original post

2 REPLIES 2
BIanon
Resolver I
Resolver I

Still not sure what has caused this but I ended up tweaking the underlying DAX behind bins for my purpose:

VAR _RDown = ROUNDDOWN( 'Table'[Item Price] / 10, 0 ) * 10
VAR _RUp = ROUNDUP( 'Table'[Item Price] / 10, 0 ) * 10
VAR _RUpCheck = IF(_RDown = _RUp, _RUp + 10, _RUp)

RETURN
IF(
    ISBLANK( 'Table'[Item Price] ),
    "N/A",
    IF( 'Table'[Item Price] < 0, "N/A",
        IF(
            'Purchase'[Item Price] >= 0,
            CONCATENATE(
                _RDown,
                CONCATENATE( "-",
                    _RUpCheck
                )
            )
        )
    )
)

 
Seems to work allright but I'm still testing tho.

Hi @BIanon ,

Thanks for your feedback and sharing your solution here.  If your solution works well, could you please mark your post as Answered? It will help the others in the community find the solution easily if they face the same problem as yours. Thank you.

Best Regards

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.