Posts

Showing posts with the label Power BI

Get The Distinct Count Of Values By Each Day Using DAX

Image
  We have a serious issue when it comes to calculating the distinct count of values based on dates, why? cause if you want to get the distinct count for each day, the usual distinct count measure will ignore the day-by-day calculating and will get the distinct count for the whole period.  so let's see how to overcome this. The solution is simple ... we will create a summarization by date and we will iterate through it calculating the distinct count This is the original measure that calculates the distinct count This is our new adjusted measure it simply defines a variable that holds a summarization of our table by date  and through this summarization , we will iterate and calculate the sum of the distinct count for each day Here we can see that for one day the two measures give the same value and it's reasonable  This is the tricky part that the new measure overcomes, for more days, the old measure gets the unique values for the whole bunch of days, not for each day....

شرح الأداة الرائعة Tabular Editor للـ Power BI

Image
  مميزات أداة Tabular Editor للـ Power BI : يمكنك نسخ الـ Measures من تقرير لتقرير اخر بكل سهولة يمكنك عمل Calculation groups والتي ستقلل عدد الـ Measures في التقرير يمكنك عمل Folders لتقسيم الـ Measures بشكل واضح يمكنك عمل مئات الـ Measures بسهولة بدون ان يحتاج التقرير للتحميل عند كل مرة والذي سيوفر عليك وقت كبير! أولا لتحميل الاداة من Github اضغط  هنا  نسخ الـ Measures من تقرير لتقرير اخر بكل سهولة: يمكن نسخ جميع الـ Measures الخاصة بك من تقرير لاخر بشرط ان يكون التقريران بهما نفس البيانات لمعرفة الطريقة من هنا .  عمل Calculation groups والتي ستقلل عدد الـ Measures في التقرير: الـ Calculation groups هي طريقة لتقليل عدد الـ Measures فمثلا اذا كان عندك Measures لحساب قيم معينة وتريد ان تحسب كل القيم Year to Date أو Month To date وهكذا … بدلا من ان تنسخ كل هذه الـ Measures وتطبق عليها فلتر DATESMTD أو DATESYTD يمكن عمل calculation item والذي بدوره سيطبق هذا الفلتر على كل  الـ Measures  لمعرفة الطريقة من  هنا . عمل Folders لتقسيم الـ Measures بشكل و...

REDUCE Your Measures With Calculation Groups In Power BI

Image
  You will need an external tool Tabular Editor for this. If you already don't have it, then please install it first. You can visit the Tabular Editor website to download the latest installer. Calculation groups are a new feature in DAX, inspired by a similar feature available in MDX known as calculated members. Calculation groups are easy to use; however, designing a model with calculation groups correctly can be challenging when you create multiple calculation groups or when you use calculation items in measures. Let's see first why calculation groups are useful: Imagine we have these measures: Sales Amount   := SUMX ( Sales , Sales[Quantity] * Sales[Net Price] ) Total Cost     := SUMX ( Sales , Sales[Quantity] * Sales[Unit Cost] ) Margin         := [Sales Amount] - [Total Cost] Sales Quantity := SUM ( Sales[Quantity] ) And we want to calculate YTD, MTd ...etc for these measures: YTD Sales ...

Filter a Column With Values of Another Column Using DAX Instead of Many to Many Relationship

Image
So you want to filter a column in table A with values in a column in table B, but both contain duplicated data, the many to many can resolve this but I don't think this is your best approach so let's discuss how you can get around this. why you may not want to use Power BI Many to Many even though you think you do: Well, according to Power BI itself the many to many relationships create some ambiguity in your data and to your end-user as he/she won't know which column should he use to filter the data,  also according to Patrick from guy in a cube , it's not your best approach. so here I'm going to introduce two approaches to solve this one that Patrick has already introduced  and that one I've found using DAX and it is mind-blowing!  First, let's look at the kind of ambiguity I'm talking about: Here I've created some dummy data where table A and B contains city column A with the sales of each city Both columns contain the city name more than one so i...