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
FelipMark
Helper I
Helper I

Use count with measure

Hi guys, I have a doubt about something that I believe is simple.

I created a conditional measure in DAX to understand if the product passed the reorder point or not.

 


# Status Stock = SWITCH(
TRUE(),
SUM(fStock[STOCK]) >= [Order Point], "Ok",
SUM(fStock[STOCK]) >= [Order Point] * 0.8, "Attention",
"Request Product")

 

I would like to create a chart that contains the count of each of the 3 statuses. But when trying to use the Count function, it is not allowed to include measures, only columns.

2 REPLIES 2
tamerj1
Super User
Super User

Hi @FelipMark 

Manually create a single column table 'Statuses' that contains the 3 statuses. Then you can place 'Statuses'[Status] in the x-axis and the following measure in the values. 
Count =
SUMX (
CROSSJOIN ( VALUES ( 'Statuses'[Status] ), VALUES ( fStock[Material ID] ) ),
INT ( 'Statuses'[Status] = [Status Stock] )
)

milanpasschier3
Resolver I
Resolver I

Hey, can you create a calculated column of this measure so that you can use it as a column for the chart?

 

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.

Top Solution Authors