Forum Discussion

woony's avatar
woony
Frequent Visitor
4 years ago
Solved

AND filter or Slicer visual

Hello I am quite new to PowerBI and I can not seem to figure out the following.   I have a DIM table of "Installs" a DIM table of "Modules" and a FACT table of "Modules per Install". for examble....
  • v-angzheng-msft's avatar
    4 years ago

    Hi, woony 

    The method in Greg_Deckler 's blog seems amazing and that seems to work, but for me as you said, the DAX part is hard to understand and I still don't understand why it works. I need to take time to figure it out.

     

    I try to solve the problem myself and here is my solution.
    to create a measure to get the Name:

    _NAME = 
    
    VAR _Module_ID=SUMMARIZE(ALLSELECTED('Modules'),[module_ID])
    
    var _Install_ID=SUMMARIZE(FILTER(ALL(Facts),'Facts'[InstallID]=MAX('Facts'[InstallID])),[ModuleID])
    
    var _except=EXCEPT(_Module_ID,_Install_ID)
    
    var _count_NOT_ID=COUNTROWS(_except)
    var _theID=IF(_count_NOT_ID=BLANK(),0,_count_NOT_ID)
    
    var _if=IF(_theID=0,
    CALCULATE(MAX('Installs'[InstallName]),FILTER(ALL('Installs'),'Installs'[InstallID]=MAX('Facts'[InstallID]))))
    
    return _if
    Count_Name = 
    var _t=SUMMARIZE(ADDCOLUMNS('Facts',"_name",[_NAME]),[_name])
    
    return COUNTAX(_t,[_name])

     

    Result:

     

     

    Please refer to the attachment below for details. Hope this helps.

     

     

    Best Regards,
    Community Support Team _ Zeon Zheng


    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.