dax

I need to do status counts every day on power bi

谁都会走 提交于 2019-12-11 17:22:43
问题 I have a log table that shows me the order log per day. This table contains one measure and one column which are: Column Date: AllDates = CALENDAR(MIN('LOG'[DTH_INCLUI_LOG]);MAX('LOG'[DTH_INCLUI_LOG])) Measure LogStatus: VAR CurrentDate = SELECTEDVALUE(AllDates[Date]) VAR MaxDate = CALCULATE(MAX('LOG'[DTH_INCLUI_LOG]);'LOG'[DTH_INCLUI_LOG] <= CurrentDate+1) RETURN CALCULATE(MAX('LOG'[VLR_NOVO]); 'LOG'[DTH_INCLUI_LOG] = MaxDate) This column and measure was this table: enter image description

DAX conditional sum

若如初见. 提交于 2019-12-11 16:54:39
问题 How to construct a DAX measure which returns sum of either A or B. The logic is take B if A is empty. So expected results looks like this: +---+---+----------+ | A | B | Expected | +---+---+----------+ | 1 | | 1 | | 1 | | 1 | | | 2 | 2 | | 1 | 2 | 1 | | | 2 | 2 | +---+---+----------+ | 3 | 6 | 7 | +---+---+----------+ When I use measure: Measure = IF(ISBLANK([SUM(tab[A])]), SUM(tab[B]), SUM(tab[A])) I get 3 for total which is logical but not what I expect. 回答1: I'd recommend using a SUMX

Power Bi - Add thousands separator to cards

老子叫甜甜 提交于 2019-12-11 16:38:32
问题 I have some DAX which adds the thousands separator to my card totals which I use in a measure: Add Separator Measure = VAR right = RIGHT ( [Card Total Measure], 3 ) VAR left = SUBSTITUTE ( [Card Total Measure] , right, "" ) RETURN COMBINEVALUES ( ",", left, right ) Only drawback is that when the total is 0 it keeps the thousands separator before the total e.g. (,£0). How can I add some logic that will remove the separator if the total is 0 to the existing dax? 回答1: This is not a good way to

Power BI why circular dependency is detected

孤街醉人 提交于 2019-12-11 16:20:00
问题 Can you please explain why I run into this alert message of circular dependency when I try to create relationship between dimension #product (or #region) and a #bridge table which is a Cartesian of product x region? I have connected #bridge with Sales and Budget by single column P@G witch is concatenation of product and region. Download file here: PBIX 回答1: A quick and dirty solution is to creat to new versions of #product and #region by using VALUES . This is probably not the best way of

YTD Average in DAX

空扰寡人 提交于 2019-12-11 16:14:42
问题 Need to calculate YTD Average and LYTD Average in DAX , Our Fiscal year starts from Apr. So if my current day is 5th of the June 2017 then lytd_AVG would be from Apr to June would be (MTD Aprn 17) + (MTD May 17) + (MTD June 17)/3 and LYTD_AVG would be (MTD Apr 16) + (MTD May 16) + (MTD June 16)/3 Assuming my current date is 06-03-2017, the YTD avg would be 60 回答1: Assuming your data is given monthly (since you have no sample data), for YTD you should be able to use something that looks like

DAX Sum of Average to Rank

老子叫甜甜 提交于 2019-12-11 15:48:32
问题 I have a pivot table that pulls a rate by person from powerpivot. The rate is a calculated field, not a column and I need the Grand Total to show as a SUM of the rates, not an average. This is purely for ranking purposes to show who has the highest overall rates to lowest. This is what it looks like with the field I want: Person Jan-2018 Feb-2018 Mar-2018 GrandTotal [DesiredField] A 80% 71% 82% 77.6% 233% B 76% [blank] 85% 80.5% 161% C 82% 85% 79% 82% 246% So person C would be at the top

Searching for DAX formula - equivalent to Excel SUMIF

自古美人都是妖i 提交于 2019-12-11 15:38:49
问题 I am searching for a DAX formula. Specifically: If SOLD (1st column) = count volume (second column), if not SOLD = 0 I need to reflect the volume of SOLD in a new column. UNSOLD Volumes should be 0. I attach the reduced data set. 回答1: If I understand, you want to only perform aggregation when the SOLD_UNSOLD column is equal to "SOLD", otherwise return 0? If so, the following formula will do this, you'll just need to update the column names accordingly. The outer IF prevents problems resulting

Compare totals for the same partial date range year-over-year in DAX / Power BI

喜夏-厌秋 提交于 2019-12-11 15:23:40
问题 I'm trying to create a table which shows a sum of monthly values for one year compared to the last year's totals (structured as the screenshot below): Monthly Comparison However, the caveat I'm dealing with is comparing the most current month, which will always contain partial month data (unless it's the last day of the month), to the same date range of the previous year. In the screenshot I attached, our data for January 2018 only goes through January 22nd. However, it's comparing it to the

How to calculate daily population in DAX

前提是你 提交于 2019-12-11 15:17:48
问题 I'm trying to calculate the daily population of patients at our center for any given date using the patient's booking date (start date) and their release date -- using DAX and Power Pivot. I'm planning on using it in PowerBI eventually. I've tried the formula below. I'm not getting any errors, but when I go to create a pivot table/chart in excel, I'm not getting the correct output. I'm only using two tables: 1) a main table with the patient data and 2) a date table (calendar) and have

I will like a script in power bi that will calculate percentage increase or decrease from one month to the previous month

拈花ヽ惹草 提交于 2019-12-11 15:13:26
问题 I want to display percentage increase or decrease in total for each month as I select each month i.e when I click on FEB, it should tell me whether there was a percentage increase/decrease in expenses compared to JAN. I have tried different codes but keep getting an error message. Here is a DAX CODE I tried: change perc = VAR ValueLastMONTH = CALCULATE ( SUM ( population[TOTAL] ), FILTER ( population, population[MONTH] = ( EARLIER ( population[MONTH] ) - 1 ) && population[CATEGORY] = EARLIER