Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

IF and COUNTIFS Excel Syntax to DAX - need help making calculations using DAX

Hello everyone!   I am trying to take a concept from an Excel Spreadsheet I have and recreate that in a Power BI matrix report.   The reason I don't just use the Spreadsheet as my data source is ...
  • bcdobbs's avatar
    bcdobbs
    4 years ago

    Measures for each column:

    No Encryption Laptops = 
    CALCULATE (
    	COUNTROWS ( EPMTable ),
    	EPMTable[Encryption Method] = "0 - None",
    	EPMTable[Platform] = "Laptop"
    	)
    	
    Encrypted Laptops = 
    CALCULATE (
    	COUNTROWS ( EPMTable ),
    	EPMTable[Encryption Method] <> "0 - None",
    	EPMTable[Platform] = "Laptop"
    	)
    	
    Percentage Encrypted = 
    VAR Laptops = 
    	CALCULATE (
    		COUNTROWS (EPMTable),
    		EPMTable[Platform] = "Laptop"
    		)
    
    VAR PercEncypted = 
    	DIVIDE (
    		[Encrypted Laptops],
    		Laptops
    		)
    
    RETURN
    	PercEncypted