"DAX the Sandcastle Sorcerer: A Tale of Shells, Spells, and Sandy Smiles!"
Amira Bedhiafi
Data Witch | Microsoft MVP Data Platform | Microsoft MVP Power BI | C# Corner MVP | Full Stack Business Intelligence Engineer
Once upon a time, in a sunny seaside town, there was a group of friends who loved playing on the beach. Their favorite game was building sandcastles, and they would spend hours creating magnificent structures in the soft, golden sand.
Among these friends was a curious and clever child named Alex. Alex had a special tool called DAX, which had magical powers to help organize and rearrange things. The friends were amazed by DAX's abilities, and they would often gather around Alex to see the wonders it could perform.
One sunny day, the friends decided to have a sandcastle contest. Each friend had their own bucket full of seashells, rocks, and other trinkets that they could use to decorate their sandcastles. It was a delightful sight to see the vibrant colors and sparkling treasures spread out before them.
DAX came to the rescue when it was time to count the seashells. Alex used the SUM function in DAX, and with a wave of the tool, the seashells were magically added up, revealing the total number in each friend's bucket. The children giggled with excitement as they compared their collections.
As the contest progressed, the friends discovered that some seashells were shinier than others. They wondered how many shiny seashells each of them had. Alex smiled and used the COUNT function in DAX. With a twirl of the tool, the shiny seashells were counted, and the friends cheered when they found out who had the most.
The sandcastles were growing taller and taller, each one more impressive than the last. The friends wanted to know which sandcastle was the tallest. Alex knew exactly what to do. Using the MAX function in DAX, the tool scanned the sandcastles, measuring their heights, and declared the tallest sandcastle with a triumphant beep.
But the magic of DAX didn't stop there. Alex discovered the CALCULATE function, which could make the sandcastles even more marvelous. With a gentle touch of DAX, the sandcastles grew taller and more grandiose, bringing joy and amazement to everyone.
The friends marveled at the power of DAX, as it helped them organize their seashells, count the shiny ones, find the tallest sandcastle, and make their creations even more impressive. They realized that DAX was like a helpful friend, always there to assist them in their sandcastle adventures.
From that day forward, DAX became an important part of their beach games. It brought new possibilities, creativity, and fun to their sandcastle building. And as the sun set on the horizon, casting a warm, orange glow over the beach, the friends continued to build sandcastles, using their magical tool to create endless wonders.
Here are a few examples to help you understand different types of context in DAX:
1. Sum Context: Imagine you have a bucket full of seashells. Each seashell represents a number. If you want to know the total number of seashells in the bucket, you would use the SUM function in DAX. It adds up all the seashells in the bucket and gives you the total.
2. Filter Context: Now, imagine you have different types of seashells in your bucket, such as white shells, striped shells, and shiny shells. If you want to count only the shiny shells, you can use the COUNT function in DAX with a filter. The filter tells DAX to consider only the shiny shells and count how many there are.
3. Row Context: Let's say you and your friends are making sandcastles of different sizes. Each sandcastle has a number that represents its height. If you want to find the tallest sandcastle, you can use the MAX function in DAX. It checks the height of each sandcastle and gives you the maximum height.
4. Calculate Context: Now, imagine you have a special toy that can make the sandcastles grow taller. If you want to increase the height of all the sandcastles by a certain amount, you can use the CALCULATE function in DAX. It tells DAX to apply a specific rule to modify the height of each sandcastle.
Business Workflow Analyst specializing in Speech Analytics and Data Analysis
1 年Yes and no... sometimes people need a foundation before getting to more complex things. For example, would I describe DAX as hard to understand? On principle, no. But then you'll need to work your way through aggregations before going to time intelligence. If Excel allows for SUM, AVERAGE, COUNT, etc across cells, Power Query or Power BI allows for the same across tables using DAX. In other words: do not start from RANKX.
Learner | Co-Founder @Enqurious | Helping organizations upskill industry ready data + AI teams on the go
1 年Love this, very well explained. Easy to understand