Forum Discussion

x0's avatar
x0
Helper I
2 years ago

Dax showing wrong value

Hello All, 

 

I have some query regard dax i use dax but showing wrong value on my card visual 

first measure is need to count how many time my name is apper on firstname column if 5 time show me value 5 

Number of Leasing Agents =
CALCULATE(
    COUNTROWS(
        FILTER(
            VALUES('J Turner Dashboard'[First Name]),
            'J Turner Dashboard'[First Name] <> BLANK()
        )
    ),
    ALLEXCEPT('J Turner dashboard', 'J Turner Dashboard'[Property], 'J Turner Dashboard'[Month1],'J Turner Dashboard'[YearPart])
)
so my need with this 2nd measure that i need count row after i filterd by month and property and year so i check manually but count is showing wrong even i use dax studio but showing incorrect value 
2nd measure 
Number of Prospect Survey Score =
CALCULATE(
    SUMX(
        VALUES('J Turner Dashboard'[First Name]),
        IF(
            NOT(ISBLANK('J Turner Dashboard'[First Name])),
            1,
            0
        )
    ),
    ALLEXCEPT('J Turner dashboard', 'J Turner Dashboard'[Property], 'J Turner Dashboard'[Month1],'J Turner Dashboard'[YearPart])
)
and 3 measure 
TotalPropertyIndex_Filtered. =
CALCULATE(
    AVERAGE('J Turner dashboard'[Property Index]),
    ALLEXCEPT('J Turner dashboard', 'J Turner Dashboard'[Property], 'J Turner Dashboard'[Month1])
) i want avrage from propertyindex column 
can i get help from anyone to fix this measure 
take  a look screnshot j turner showing 8 and 8.43 this 2 card showing wrong value i check manually in data view its only 6 and 8.33 and also look in matrix value show me wrong count there are only 6 agent and agent has 4 time name and 2 agent has 1 time but matrix value show wrong count 

 

 

6 Replies

  • Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

    Do not include sensitive information or anything not related to the issue or question.

    If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216

    Please show the expected outcome based on the sample data you provided.

    Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

  • Anonymous's avatar
    Anonymous
    Not applicable

    Assuming i've understand what you are trying to achieve, i'd suggest first you need to split your base aggreations into their own measures, then use a calculate statement to call that base measure with the added context to achieve your aims.  I think what you are trying to achieve is this:

    Name Count = COUNT('J Turner Dashboard'[First Name])

    (Count function ignores blanks)

    Row Count = COUNTROWS('J Turner Dashboard')
    Avg Property Index = AVERAGE('J Turner dashboard'[Property Index])
    Number of Leasing Agents = CALCULATE(
    	[Name Count],
    	ALLEXCEPT('J Turner dashboard', 'J Turner Dashboard'[Property], 'J Turner Dashboard'[Month1],'J Turner Dashboard'[YearPart])
    )
    Number of Prospect Survey Score = CALCULATE(
    	[Row Count],
    	ALLEXCEPT('J Turner dashboard', 'J Turner Dashboard'[Property], 'J Turner Dashboard'[Month1],'J Turner Dashboard'[YearPart]),
    	NOT ISBLANK('J Turner Dashboard'[First Name])
    )
    TotalPropertyIndex_Filtered = CALCULATE(
    	[Avg Property Index],
    	ALLEXCEPT('J Turner dashboard', 'J Turner Dashboard'[Property], 'J Turner Dashboard'[Month1],'J Turner Dashboard'[YearPart]),
    	NOT ISBLANK('J Turner Dashboard'[First Name])
    )

    (I added the non-blank to the average calculation to ignore the same rows as the other measures)

    • x0's avatar
      x0
      Helper I

      Hello Anonymous 

       

      Please have a look after trying your approach 

      and this is original 

      help me out for accurate result. 

      • Anonymous's avatar
        Anonymous
        Not applicable

        Seems like you want a distinct count instead of a regular count. Change the measure to be this:

        Name Count = DISTINCTCOUNT('J Turner Dashboard'[First Name])

         

    • x0's avatar
      x0
      Helper I

      Hello Anonymous 

       

      I think so there is some filtering issue 

      i dont understand how it would process for filter but i check by add on filter pane 

      i add year , monthindex , property and first name 

      and if i check mark select show me correct count 

      it should be work automatically why it is not filtering ?