Posts

Showing posts from July, 2021

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. when the s

شرح الأداة الرائعة 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 بشكل واضح: يمكنك تقسم جميع الـ 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 Amount := CALCULATE (      [Sales Amount] ,      DATESYTD (