How to use DAX in Power BI | Microsoft Power BI for Beginners

preview_player
Показать описание
In this series we will be walking through the basics of Microsoft Power BI. In this video we will be walking through how to use DAX in Power BI.

Favorite Power BI Courses:
____________________________________________

SUBSCRIBE!
Do you want to become a Data Analyst? That's what this channel is all about! My goal is to help you learn everything you need in order to start your career or even switch your career into Data Analytics. Be sure to subscribe to not miss out on any content!
____________________________________________

RESOURCES:

Coursera Courses:

Udemy Courses:

*Please note I may earn a small commission for any purchase through these links - Thanks for supporting the channel!*
____________________________________________

SUPPORT MY CHANNEL - PATREON/MERCH

____________________________________________

Websites:
📱Instagram: @Alex_The_Analyst
____________________________________________

0:00 Intro
0:35 Looking at the Data
1:08 Creating a Measure
1:43 DAX - Count
3:30 DAX - SUM
4:43 SUM vs SUMx
10:19 DAX - Date Functions
13:50 DAX - If Statement
14:55 Outro

*All opinions or statements in this video are my own and do not reflect the opinion of the company I work for or have ever worked for*
Рекомендации по теме
Комментарии
Автор

If people learn the DAX theories properly such as row context, filter context, context transition and iterators then you're on the path of becoming a pro at DAX.

nayeem
Автор

It is a great video. When I was going through it I was little bit confused by the profit_column calculation as it was not matching with my pre-made profit_measure.
so for little modification --->
Profit by Product =
CALCULATE(
(SUM('Apocolypse Store'[Price]) - SUM('Apocolypse Store'[Production Cost])) * SUM('Apocolypse Sales'[Units Sold]),
FILTER(
ALL('Apocolypse Sales'),
'Apocolypse Sales'[Product ID] = EARLIER('Apocolypse Store'[Product ID])
)
)

-->here are 2 parts inside calculate(). One is the equation and another is the filter().
The filter() gets only those product_ids from sales table that are present in the store table. After getting those product_ids from sales table, it simply applies the formula on it.

I hope it helps.

Also luckily gives me same output as my profit_measure.

visualization-with-neha
Автор

Hey Alex. I hope you get to read this. The profit that was calculated with SUMX is incorrect. You multiplied the profit of each product with the sum of all products sold instead of the sum of each individual product.

I made a separate column in apocalypse store table and made it equal to the measure [Sum of Products Sold] that was done earlier in the video. That gives the correct amount of product sold for each product and named it Products_Sold. Then I used that column to multiply it to the profit. So in a new column I put ([Price] - [Production Cost]) * [Products_Sold]. That will give you the correct profit.

TheDavesterist
Автор

Great job explaining this. I am an absolute whiz with excel and just after watching your video, never using Power BI, I feel like I could open it up and start creating some pretty useful tables and graphs. Really appreciate you taking the time to create this video.

StopTryinMe
Автор

Alex, I get it you just used some random examples to explain sum and sumx and you explained them pretty well.
But the profit result value is wrong, you can't calculate profit by (sum(all selling prices)-sum(all cost prices) * sum(all units)) because each product has different selling price and cost price.
correct method is: for each product = SP-CP * units sold(of that particular product)
then sum all these values
correct profit value = 43212.43

Love your content. helped me a lot

gaminggunz
Автор

Thanks so much Alex for taking your time to break this down to the smallest bits for us.
I have gained a lot from this video.

monisolaoyeyemi
Автор

Alex, you probably already knew this and did it just for demonstration purposes, but for anybody watching this, SUMX is redundant in a calculated column the way it was used here because in a calculated column, it's already evaluating row by row. The below would've worked just the same in this example at 10:05:

('Apocolypse Store'[Price] - 'Apocolypse Store'[Production Cost]) * [Units Sold]

Second note (because this took me way longer to stumble across than I would've liked!): Instead of nested IF statements, look into the SWITCH function. It essentially lets you put all the conditions you would've put in a nested IF into one function. :D

EDIT: I meant to mention that Alex will be one of only four people ready for the apocalypse when it hits. I see you on the list of customers, Alex. 😂

wilsonman
Автор

Hello Alex Thank you so much for sharing this. I think you made an error at 09:04 . I think first you were supposed to calculate profit for each Product which will be Profit_for_each Product = 'Apocolypse Store'[Price] - 'Apocolypse Store'[Production Cost] then you calculate total_profit for each product which will be Total_Profit = 'Apocolypse Sales'[Sum of Products Sold] * 'Apocolypse Store'[Profit_for_each Product]

champmotivation
Автор

Hey Alex, great job! I just wanted to give you a quick heads up about a small correction that needs to be made to the calculation for the Profit column. It seems like the formula used in the video isn't giving the right results. Here's a suggestion for a different formula that should work better: Profit = ('Apocolypse Store'[Price]-'Apocolypse Store'[Production Sales'[Product ID]), CALCULATE(SUM('Apocolypse Sales'[Units Sold])))

leylaalkan
Автор

Easier solution: First make a profit column: Profit_column = 'Apocolypse Store'[Price] - 'Apocolypse Store'[Production Cost]
Second make a Total profit column: Total_profit = 'Apocolypse Store'[Profit_column] * SUM('Apocolypse Sales'[Units Sold])

mikefranko
Автор

Thank Alex for this. It doesn't make sense yet because I'm just getting started on my Data Analysis Journey but I'm hoping to come back here in a few weeks and brag about how this video is useful for me.

P.S. I've saved this in my YouTube Library for future references.

promiseatiti
Автор

Hey Alex,
You are an amazing teacher for real. Thanks a lot for explaining these concepts so well . Its really helping all of aspiring Data and Business Analyst a lot. I really feel your videos are very engaging and so informative .

inspiringmind
Автор

Hey Alex, good video .You are good teacher for real. Hopefully u get the time to do more videos on power bi and dax. Took your advice annd I completed the GDA courses at coursera and got my certificate. Thank you for that. "Great courses". I felt power bi should be included as well.

abbielmi
Автор

Love this new series. Keep up the great work Alex !

Magmatic
Автор

At 9:04 It is mentioned that Apocalypse Sales is the table we are looking here, but the table we were working on was Apocalypse Store. Can you explain that part please? Also, when I tried to change the Sales to Store in the SUMX, it gave error. I am new to PowerBI, so maybe asking a bad question, but it would be helpful if I could get an explaination. Thanks.

supergamefreak
Автор

Hey Alex, Thanks for the videos, I've been learning a lot from you.
Quick doubt, shoudn't we get the profit from the difference of price and product costs multiplied by the sum of the product sold, and not by the TOTAL (3001) of product sold?. Doing by the TOTAL of product sold, we are not getting the profit by Product but the Total Revenue. Am I Thinking wrongly?

Appreciate your videos!!

thaynangamarano
Автор

If you were stuck like me in the Profit colmun => Profit Column = ('Apocolypse Store'[Price]-'Apocolypse Store'[Production Cost])*SUM('Apocolypse Sales'[Units Sold])

alcarajo
Автор

Alex, are you sure you calculated the SUMx in a correct way? Because it multiplies each row by 3001 so the total number of products sold, not individual for each row. For example, duct tape - 2.75 - 1.01 = 1.74 this is a profit for one duct tape, and then you multipled it by 3001 not 365 so 1.74 * 3001 = 5221.74. Shouldn't it be 1.74 * 365 = 635.1? Please reply because i've spent a lot of time being confused and trying to understand how it works ;)

gosiafabiszak
Автор

Thank goodness for chartGPT, I almost gave up for those freshers like me that struggled use this SUMX( 'Apocolypse Sales', ('Apocolypse Store'[Price] - 'Apocolypse Store'[Production Cost]) * 'Apocolypse Sales'[Units Sold])

shamisomaisiri
Автор

I always wince at your battle cry of "WHATSGOINGONEVERYBODY!" :)

peroverodexi