dax

DAX conditional sum of two columns with different granularity

戏子无情 提交于 2019-12-29 09:27:46
问题 This is follow up question of the one asked here. However this time two columns have different granularity and are located in different tables. So simple SUMX solution proposed earlier is not applicable. I attach SumDifferntGranularity.pbix file. How to construct a DAX measure which returns sum of either BudgetProduct (if possible) or BudgetBrand. The logic is take Brand if Product is empty. So expected results looks like this: +---------+-------------+---------------+-----------------+ |

Get “Week of 2nd” from Date field in power BI

北城以北 提交于 2019-12-25 11:56:23
问题 I have a date field in my DimDate table. I want to get another column WeekOf that would show the week number based on Monday. For example I have date: Date WeekOf 10/2/2017 Week of 2nd 10/9/2017 Week of 9th 10/16/2017 Week of 16th 回答1: Creating a new column with the following formula should give you what you want. If you every want to change it to be the Week of a different day, change the 2 in the TargetDate variable to which ever day of the week you want. WeekOf = VAR TargetDate = DAY

Power BI getting 2 week back same day value

橙三吉。 提交于 2019-12-25 08:09:08
问题 I need to create a measure in Power BI which will always provide the value of sales amount 2 weeks back for the same weekday. e.g Today = Tuesday 27-Sep-2016 so I need value for Tuesday 13-Sep-2016 The Table is simple with following structure Date | SalesAmount ----------------------------- 01-Sep-2016 | 500 02-Sep-2016 | 450 03-Sep-2016 | 650 回答1: You can use DATEADD() function to compute the 14 days before each date. Create a measure using the below code. SalesTwoWeeksAgo = CALCULATE ( SUM

Count Failures in PowerBI

佐手、 提交于 2019-12-25 04:28:48
问题 I am developing a dashboard in Power Bi and I am trying to come up with a way by which I can indicate or count the number of "fail"s in the following column: **Status** Column2 Column3 Column4 success data numbers email success data facts email fail data figures email success moredata science email success somuchdata magic email success stuff etc email success things etc email The first problem is that in some cases, all of the values in the column will be "success". So I can't just do a

SSAS DAX time intelligence previous year and calculation gives wrong value

心已入冬 提交于 2019-12-25 03:26:50
问题 We want to show current periods sales versus previous period sales. To show the previous period we make use of a date dimenion table and the following calculation: CALCULATE(SalesValueGross; DATEADD(Date[Date]; -1; YEAR)) Unfortunately somehow it shows minor (decimal) differences when comparing years. The difference get's bigger when we slice to months. Another issue we have is that this calculation does not seem to work when comparing (for example) week 1 - 2015 with week 1 - 2014. Any help

Summing up a related table's values in PowerPivot/DAX

雨燕双飞 提交于 2019-12-25 03:24:35
问题 Say I have two tables. attrsTable: file | attribute | value ------------------------ A | xdim | 5 A | ydim | 6 B | xdim | 7 B | ydim | 3 B | zdim | 2 C | xdim | 1 C | ydim | 7 sizeTable: file | size ----------- A | 17 B | 23 C | 34 I have these tables related via the 'file' field. I want a PowerPivot measure within attrsTable, whose calculation uses size. For example, let's say I want xdim+ydim/size for each of A, B, C. The calculations would be: A: (5+6)/17 B: (7+3)/23 C: (1+7)/34 I want the

updating measure calculation to apply OR logic in DAX

扶醉桌前 提交于 2019-12-25 02:55:36
问题 I'm trying to have my dimensions filter a calculation using the OR logic. I have 3 tables: 1 Fact and 2 Dimensions. SalesFact: SalesID, ProductID, StoreID ProductDim: ProductID, ProductName StoreDim: StoreID, StoreName This is the measure: Total SalesId = CALCULATE(DISTINCTCOUNT(SalesFact[SalesID]) ) This works good, but I want it to filter on either dimension selected, something like this: EVALUATE SUMMARIZECOLUMNS ( FILTER( SalesFact, SalesFact[ProductId]=15257 || SalesFacts[StoreId]=19732

Override Slicer Filter Context in Chart (To Show Fuller X-Axis)

天大地大妈咪最大 提交于 2019-12-25 02:29:11
问题 Imagine I have a fact table with sales spanning 3 years (2016-2018). I have a chart showing sales by month (36 points on the X-Axis). I have a slicer selection to Year = 2018, and Month = June. Is it possible, with a measure, to show on a chart, the trailing 6 months from the slicer selection? In other words, with the slicer still set to Year = 2018 and Month = January, can the chart display 6 points (the trailing 6 months)? How would this be accomplished? 回答1: The approach I would use in

Conditional calculation based on another column

天大地大妈咪最大 提交于 2019-12-24 23:30:11
问题 I have a cross reference table and another table with the list of "Items" I connect "PKG" to "Item" as "PKG" has distinct values. Example: **Cross table** **Item table** Bulk PKG Item Value A D A 2 A E B 1 B F C 4 C G D 5 E 8 F 3 G 1 After connecting the 2 above tables by PKG and ITEM i get the following result Item Value Bulk PKG A 2 B 1 C 4 D 5 A D E 8 A E F 3 B F G 1 C G As you can see nothing shows up for the first 3 values since it is connected by pkg and those are "Bulk" values. I am

Need to default to last nonblank value

我的未来我决定 提交于 2019-12-24 20:45:46
问题 At present that dax calculation is a simple SUM, but I need to default to the last non-blank value for the GrandTotal: For example, instead of stating 167, it should not 9: 回答1: Similar to the other question you asked, you can use HASONEVALUE to change the behavior of the Grand Total. If the column you are summing is named Table1[Value] then the measure you want will look something like this: LastNonBlankValue = VAR LastNonBlankDate = CALCULATE(MAX(DimDate[Date]), Table1[Value] > 0) RETURN IF