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
Rate
Helper III
Helper III

Grouped Chart with Measure with Calculate as Value.

Hello!

I am struggling with something I can't quite understand, and I am going sort of nuts.

 

I have a Data Table, no relations whatsoever, where I have a line for each Task our workforce is doing. They are sending information on the visits to stores, and checking if there is a Stock Shortage (or not) and the reason behind the shortage when there is.

 

I am trying to show a simple column chart with the following data:

- Values: A measure, where I guess my problem is coming from: 

Visit with Shortage =
CALCULATE(
        DISTINCTCOUNT(Task[ID Task]);
        Task[Shortage] <> "No Shortage")

- Axis: The column "Shortage", where there are text values, one per line, with the detail for the shortage or, if there is no shortage, the text "No Shortage".

 

As an example, the table I am testing with is this:

ID TaskShortage
1No Shortage
2No Shortage
3Other
4Other
5Full
6Other

 

I would want a chart with the count of tasks with the type of shortage, but not the column with "No Shortage". The graph I am obtaining is this one:Screenshot_1.png

 

 

I know that I could simply add a filter to the chart, but I am more interested in learning the reason why this is not working as I intend.

 

Thanks a lot!!

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @Rate ,

 

To update your measure as below.

 

Visit with Shortage = 
VAR st =
    MAX ( 'Task'[Shortage] )
RETURN
    IF ( st <> "No Shortage", DISTINCTCOUNT ( Task[ID Task] ), BLANK () )

Capture.PNG

 

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

View solution in original post

3 REPLIES 3
v-frfei-msft
Community Support
Community Support

Hi @Rate ,

 

To update your measure as below.

 

Visit with Shortage = 
VAR st =
    MAX ( 'Task'[Shortage] )
RETURN
    IF ( st <> "No Shortage", DISTINCTCOUNT ( Task[ID Task] ), BLANK () )

Capture.PNG

 

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

Hello @v-frfei-msft ,

 

That worked like a charm! Thank you so much!

 

Regards!

RobbeVL
Impactful Individual
Impactful Individual

Hi,

 

Your calculation actually doesnt make much sense.

You are trying to filter your measure, while you actually need to filter your axis.

 

You could create a more "complex" measure to filter out no shortage, but filtering your visual or dataset would make alot more sense.

 

Robbe

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.