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
bikelley
Helper IV
Helper IV

Why I am not getting value on KPI but getting value on Table? (Calculated Measure)

HI, 

 

I am trying to calculate employees with a positive Avg Daily Var % and I have a few ranges (From 0 to -10). I want to know how many people are on each range in a KPI, but my measure is working on a table not in the KPI. Can anybody please help me to fix this? 

 

Sample since I have few measures, 

https://drive.google.com/file/d/1fWYZNYuLrRSU81fAU2YGzuJA-VF3KiZL/view?usp=sharing 

 

Formula - 

Positive = COUNTROWS(FILTER(VALUES(Employee[firstlast]),Measures_Unit[Unit_Avg_Daily_Var._in_%] >0))
From 0 to -10% = COALESCE(
                    COUNTROWS(
                        FILTER(
                            VALUES(Employee[firstlast]),
                            (Measures_Unit[Unit_Avg_Daily_Var._in_%] <0.01 && Measures_Unit[Unit_Avg_Daily_Var._in_%] >= -0.1)
                            )),0)

Data- 

Capture.PNG

 

 Thank you so much

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

Hi @bikelley ,

According to my understand, you want to count distinct values when [measure]>0 , right?

You could use DISTINCTCOUNT() or DISTINCTCOUNTNOBLANK() functions to calculate.

 

 

po =
CALCULATE (
    DISTINCTCOUNT ( Employee[firstlast] ),
    FILTER ( 'Employee', [Unit_Avg_Daily_Var._in_%] > 0 )
)
from =
CALCULATE (
    DISTINCTCOUNT ( 'Employee'[firstlast] ),
    FILTER (
        'Employee',
        Measures_Unit[Unit_Avg_Daily_Var._in_%] < 0.01
            && Measures_Unit[Unit_Avg_Daily_Var._in_%] >= -0.1
    )
)

 

 

My final output looks like this:

11.27.1.1.PNG

 

Here is the pbix file.

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.

 

Best Regards,
Eyelyn Qin

View solution in original post

4 REPLIES 4
v-eqin-msft
Community Support
Community Support

Hi @bikelley ,


Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.

 

Best Regards,
Eyelyn Qin

v-eqin-msft
Community Support
Community Support

Hi @bikelley ,

According to my understand, you want to count distinct values when [measure]>0 , right?

You could use DISTINCTCOUNT() or DISTINCTCOUNTNOBLANK() functions to calculate.

 

 

po =
CALCULATE (
    DISTINCTCOUNT ( Employee[firstlast] ),
    FILTER ( 'Employee', [Unit_Avg_Daily_Var._in_%] > 0 )
)
from =
CALCULATE (
    DISTINCTCOUNT ( 'Employee'[firstlast] ),
    FILTER (
        'Employee',
        Measures_Unit[Unit_Avg_Daily_Var._in_%] < 0.01
            && Measures_Unit[Unit_Avg_Daily_Var._in_%] >= -0.1
    )
)

 

 

My final output looks like this:

11.27.1.1.PNG

 

Here is the pbix file.

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.

 

Best Regards,
Eyelyn Qin

amitchandak
Super User
Super User

@bikelley , Seem fine at first look. Try like

From 0 to -10% =countx(VALUES(Employee[firstlast]) ,(Measures_Unit[Unit_Avg_Daily_Var._in_%] <0.01 && Measures_Unit[Unit_Avg_Daily_Var._in_%] >= -0.1))+0

@amitchandak Thank you so much, but I am gettign an error. Any Idea why?
Capture.PNG

 

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.