Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

FILTERED Measure not working in a graph

Hello

 

I have this measure but it does not seem to work, it only displays the max of the various Legend entries in a line chart:

 

Measure =
AVERAGEX(
KEEPFILTERS(VALUES('A'[Date(bins)])),
DIVIDE(CALCULATE(AVERAGE('A'[Value]))),CALCULATE(AVERAGE('A'[Value]),FILTER(VALUES(A),A[Type]="Type1")))
)

 

Do you know what could be wrong?

 

Thanks!

4 Replies

  • Anonymous as VahidDM recommended, post sample data but try this change in the measure

     

    Measure =
    AVERAGEX(
        KEEPFILTERS ( VALUES ('A'[Date(bins)] ) ),
        DIVIDE (
            CALCULATE ( AVERAGE ( 'A'[Value] ) ),
            CALCULATE ( AVERAGE ( 'A'[Value] ),  'A'[Type] = "Type1" )
        )
    )
  • Hi Anonymous 

     

    Can you post sample data as text and expected output?
    Not enough information to go on;

    please see this post regarding How to Get Your Question Answered Quickly:
    https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

    The most important parts are:
    1. Sample data as text, use the table tool in the editing bar
    2. Expected output from sample data
    3. Explanation in words of how to get from 1. to 2.
    4. Relation between your tables

    Appreciate your Kudos!!
    LinkedIn:www.linkedin.com/in/vahid-dm/

  • v-luwang-msft's avatar
    v-luwang-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

    Could you pls share your sample data and expect output?Remember to remove confidential data.

    And you could test the below:

    TEST =
    AVERAGEX (
        KEEPFILTERS ( VALUES ( 'A'[Date(bins)] ) ),
        DIVIDE (
            CALCULATE ( AVERAGE ( 'A'[Value] ) ),
            CALCULATE ( AVERAGE ( 'A'[Value] ), FILTER ( 'A', A[Type] = "Type1" ) )
        )
    )
     

    or

    TEST =
    AVERAGEX (
        KEEPFILTERS ( VALUES ( 'A'[Date(bins)] ) ),
        DIVIDE (
            CALCULATE ( AVERAGE ( 'A'[Value] ) ),
            CALCULATE ( AVERAGE ( 'A'[Value] ), FILTER (all('A'), A[Type] = "Type1" ) )
        )
    )
     

     

    Did I answer your question? Mark my post as a solution!

    Best Regards

    Lucien

  • v-luwang-msft's avatar
    v-luwang-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

    Has your problem been solved, if so, please consider Accept a correct reply as the solution or share your own solution to help others find it.

    Best Regards
    Lucien