DAX for selectedvalue

Hi,

Would like to seek for expert help on DAX.

Collections Employee = 
VAR myCompany =
    SELECTEDVALUE ( DimURGroup02[Company] )
VAR myCollections =
    SUM ( FactCollections02[pAmount] )
Var myFilterUR001 = 
    FILTER ( FactCollections02, FactCollections02[NCompanyID] = "UR001" )
Var myFilterUR002 = 
    FILTER ( FactCollections02, FactCollections02[NCompanyID] = "UR002" )
VAR myCollectionsUR001 =
    IF ( ISBLANK ( CALCULATE ( myCollections, myFilterUR001 ) ), 0, CALCULATE ( myCollections, myFilterUR001 ) )
VAR myCollectionsUR002 =
    CALCULATE ( myCollections, myFilterUR002 )
RETURN
    SWITCH (
        myCompany,
        "UR Klinik", myCollectionsUR002,
        "UR Skin", myCollectionsUR001,
        myCollectionsUR001 + myCollectionsUR002
    )

I am trying to implement above DAX. Unfortunately, when I select UR Klinik, the 0 value in UR Skin will show as well and vise versa. May I know how to improve DAX so when I select UR Klinik, the visual will only show UR Klinik data.

Kindly assist.

Thank you.

Regards,
Dennis Tiong

@dennistgc,

It’s a bit hard to parse this without a PBIX file to clarify the problem and check the solution, but try this:

Replace the highlighted 0 with BLANK(), and then in your visual make sure the Show Items with No Data option is unchecked:

If that doesn’t work, please post a PBIX file, and I’m sure we can provide you a specific solution on this.

Thanks.

  • Brian

Thanks for posting your question @dennistgc. To receive a resolution in a timely manner please make sure that you provide all the necessary details on this thread.

Here is a potential list of additional information to include in this thread; demo pbix file, images of the entire scenario you are dealing with, a screenshot of the data model, details of how you want to visualize a result, and any other supporting links and details.

Including all of the above will likely enable a quick solution to your question.