Forum Discussion

BI_Vijay's avatar
BI_Vijay
Regular Visitor
1 year ago

Need help with a DAX formula

I have 2 measures

one is Transactions - which is nothing but the Sum(Transactions) from my Fact 'Debit Transaction' and the other one is

 'Sector Transactions' - which actually should show the value for the whole sector of a customer.

 

The measure is written in this way

 

Sector Transactions =
VAR SelectedSector = SELECTEDVALUE(Customer[Sector Name])
VAR Output1 =
    IF(
        ISBLANK(SelectedSector),
        BLANK(),
        CALCULATE(
            SUM('Debit Transaction'[Transactions]),
            FILTER(
                ALL(Customer), Customer[Sector Name]=SelectedSector
            )
        )
    )
RETURN Output1
 
 
This acutally works well. 

 

Now, if i take one more column from an another dimension then it just starts to show all the records from the other dimensions. 

 

For example: the other dimension is called - Contract and the column is called "Commercial Name" then it just shows all the values or records from the Contract Dimension. like this,

 

 

 But, the expected ourcome is, 

 

 

I basically want the CommercialName of the customer along witht the values to the measures but not all the commercialnames from the dimension

can someone help on this?

 

 

Thanks,

Vijay

6 Replies

  • _AAndrade's avatar
    _AAndrade
    Resident Rockstar

    Hi BI_Vijay,

    Please try this formula:

    Sector Transactions =
    VAR SelectedSector = SELECTEDVALUE(Customer[Sector Name])
    VAR Output1 =
        IF(
            ISBLANK(SelectedSector),
            BLANK(),
            CALCULATE(
                SUM('Debit Transaction'[Transactions]),
                REMOVEFILTERS(Customer[Main Sector Name])  
            )
        )
    RETURN Output1
    
    • BI_Vijay's avatar
      BI_Vijay
      Regular Visitor

      Thanks _AAndrade . I tried that, and it removed the filter on the Main Sector which is equivalent to the other measure "Transactions". 

      This is how the output looks like

       

       

       

      • _AAndrade's avatar
        _AAndrade
        Resident Rockstar

        Could you please share a pbix file with an example of your data and data model?