Professional Documents
Culture Documents
Power BI Class 6
Power BI Class 6
James Stratton
1 / 20
Plan for Today Harder formulas in DAX Measures Finishing up
2 / 20
Plan for Today Harder formulas in DAX Measures Finishing up
We want words to have data type text, and numbers to have data
type whole number or decimal number
If a number has data type text, then you won’t be able to make
visualizations with it!
3 / 20
Plan for Today Harder formulas in DAX Measures Finishing up
OR in DAX
We have a column for whether a farmer uses a generator
We also have a column for whether a farmer uses solar energy
What if we want to look at farmers who use either a generator or
solar energy?
In DAX, the symbol || means ‘OR’
§ You type this by pressing shift and the key just above the ‘Enter’ key
§ If you ever have to Google this, it’s called the ‘double pipe’ symbol
So our formula is . . .
SolarOrGenerator “ IF(‘My Data’[Does farmer use solar energy?] = “Yes”
|| ‘My Data’[Does farmer use generator?] = “Yes”, “Uses solar or
generator’, “Does not use solar or generator”)
4 / 20
Plan for Today Harder formulas in DAX Measures Finishing up
OR in DAX
5 / 20
Plan for Today Harder formulas in DAX Measures Finishing up
AND in DAX
6 / 20
Plan for Today Harder formulas in DAX Measures Finishing up
AND in DAX
7 / 20
Plan for Today Harder formulas in DAX Measures Finishing up
VLOOKUP in DAX
8 / 20
Plan for Today Harder formulas in DAX Measures Finishing up
LOOKUPVALUE in DAX
9 / 20
Plan for Today Harder formulas in DAX Measures Finishing up
LOOKUPVALUE in DAX
Power BI does not have VLOOKUP, but it has a very similar formula
called LOOKUPVALUE
LOOKUPVALUE is a bit harder to learn, but is actually easier to use
than VLOOKUP
10 / 20
Plan for Today Harder formulas in DAX Measures Finishing up
LOOKUPVALUE in DAX
Upload the index table of regions and branches into Power BI
§ Thanks to Khin Maung Swe for sending this!
LOOKUPVALUE in DAX
To do a LOOKUPVALUE, we need three columns
§ An index table with what we want to search
§ An index table with the result we want
§ A data table with what we want to search
LOOKUPVALUE in DAX
13 / 20
Plan for Today Harder formulas in DAX Measures Finishing up
LOOKUPVALUE in DAX
14 / 20
Plan for Today Harder formulas in DAX Measures Finishing up
LOOKUPVALUE in DAX
15 / 20
Plan for Today Harder formulas in DAX Measures Finishing up
LOOKUPVALUE in DAX
The sheet ‘My Data’ is a data table with a list of product types
The sheet ‘Products and Crops’ is an index table with a list of
product types and crops
Then use LOOKUPVALUE to get to a list of crops
Remember, the formula in Power BI is . . .
NEWCOLUMN = LOOKUPVALUE(’Index Table’[Result], ’Index
Table’[Search], ’Data Table’[Search])
Afterwards, make a graph which shows average revenue, with crops
on the axis
16 / 20
Plan for Today Harder formulas in DAX Measures Finishing up
Introduction to Measures
17 / 20
Plan for Today Harder formulas in DAX Measures Finishing up
Creating a measure
Imagine that every client’s income grows at 5% per year
How much do we predict total client revenue will be next year? What
about the year after?
We want to make a graph like . . .
18 / 20
Plan for Today Harder formulas in DAX Measures Finishing up
Dashboard
19 / 20
Plan for Today Harder formulas in DAX Measures Finishing up
Tomorrow
20 / 20