Forum Discussion

emarome94's avatar
emarome94
Icon for Helper I rankHelper I
3 years ago
Solved

Circular Dependencies - Calculated Table

Hi everyone,  I'm creating a table with the following SUMMARIZE functions:     The above Dax expression actually create a Table for the purpose I have in mind.  The problem is that I re...
  • johnt75's avatar
    johnt75
    3 years ago

    Don't filter the blank values out and then run the below in DAX Studio or Tabular Editor

    EVALUATE
    ADDCOLUMNS (
        DISTINCT ( 'Query1'[Customer number] ),
        "Customer type", IF ( CALCULATE ( [Total quantity no fob] ) >= 10000, "Top", "No top" ),
        "Total sales", CALCULATE ( [Total sales no fob] ),
        "Total quantity", CALCULATE ( [Total quantity no fob] )
    )

    By sorting the results on customer number in first ascending and then descending order you should be able to see whether there are any blanks in the result.

    You could also try

    DEFINE
        VAR T1 =
            ADDCOLUMNS (
                ALLNOBLANKROW ( 'Query1'[Customer number] ),
                "Customer type", IF ( CALCULATE ( [Total quantity no fob] ) >= 10000, "Top", "No top" ),
                "Total sales", CALCULATE ( [Total sales no fob] ),
                "Total quantity", CALCULATE ( [Total quantity no fob] )
            )
    
    EVALUATE
    ROW (
        "total rows", COUNTROWS ( T1 ),
        "total customers", COUNTROWS ( SUMMARIZE ( T1, [Customer number] ) )
    )
    

    which should give the same number for both total rows and total customers.