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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
adriancho_BI
Regular Visitor

Can't use measure as categoric

Hello! Please your help!! I'm trying to categorize a measure and then use it as columns in a Stacked Column Chart (X axis):
Measure 1: Count the phone_numbers by device_id in other table

FORMAT(CALCULATE(
    DISTINCTCOUNT(data_device[phone_number]),
    ALLEXCEPT(browsing_data_device, browsing_data_device[device_id])
),"#")

Measure 2: Here I'm trying to create a category but can't use it as I mention above
Phones By Device (Group) =
SWITCH (
    TRUE (),
    [Browsing Phones By Device] = 0, "0",
    [Browsing Phones By Device] = 1, "1",
    [Browsing Phones By Device] = 2, "2",
    [Browsing Phones By Device] >= 3, ">=3"
    )


Thanks in advance for the help : )

2 ACCEPTED SOLUTIONS
Idrissshatila
Super User
Super User

Hello @adriancho_BI ,

 

''in order to be able to use it as a column, it should be a calculated column, it won't work as a measure.



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




View solution in original post

v-xinruzhu-msft
Community Support
Community Support

Hi @adriancho_BI 

The information @Idrissshatila offered is right, you cannot put the measure to x-axis, based on the infotmation @Idrissshatila  offered, I will offer some more information for you to refer.

You can consider to create a table called type.

vxinruzhumsft_0-1710988368742.png

Then put the type to the x-axis, then  use this type column in conjunction with Phones By Device (Group). 

e.g You can to calculate the count of table.

Measure =
CALCULATE (
    COUNTROWS ( data_device ),
    FILTER ( data_device, [Phones By Device(Group)] IN VALUES ( 'Type'[Type] ) )
)

Put the measure to the value.

 

 

Best Regards!

Yolo Zhu

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

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Share some data to work with and show the expected result.  Share data in a format that can be pasted in an MS Excel file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-xinruzhu-msft
Community Support
Community Support

Hi @adriancho_BI 

The information @Idrissshatila offered is right, you cannot put the measure to x-axis, based on the infotmation @Idrissshatila  offered, I will offer some more information for you to refer.

You can consider to create a table called type.

vxinruzhumsft_0-1710988368742.png

Then put the type to the x-axis, then  use this type column in conjunction with Phones By Device (Group). 

e.g You can to calculate the count of table.

Measure =
CALCULATE (
    COUNTROWS ( data_device ),
    FILTER ( data_device, [Phones By Device(Group)] IN VALUES ( 'Type'[Type] ) )
)

Put the measure to the value.

 

 

Best Regards!

Yolo Zhu

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

Idrissshatila
Super User
Super User

Hello @adriancho_BI ,

 

''in order to be able to use it as a column, it should be a calculated column, it won't work as a measure.



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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