"time intelligence"
20 TopicsHow to make a DAX calculation return BLANK rows
I'm working on a Power Bi template for my company. Since we are a global comapny i added Time Zone tables that help the end-user filter the visual for their Time Zone. Now I'm trying to create a DAX measure that will get the values in a DATE/TIME type column and sum the given UTC Offset in Hours, however I'm having a hard time when there's no value in a give row, DAX will just either not return the rows with blank or return the offset. What I'm trying to achieve is a function that will ignore the blank values and still return them, and when there is a value actually SUM the End Time UTC with the Offset. Note: [Current UTC Offset] is a measure that returns a decimal number from -12 to +12 How can i achieve this?Solved735Views1like2CommentsInteresting effects with calendar-based time intelligence
Hi guys After some research and testing, I found several interesting effects with the new calendar-based time intelligence. For example, how dates are shifted when calculating the PY with leap years, or some strange effects with weekly calculations. I summarized them here for everyone to read: https://towardsdatascience.com/when-things-get-weird-with-the-custom-calendars-in-tabular-models/ I hope that you find it interesting. Regards, SalvatoreSolved3KViews3likes18CommentsMultiple DAX for WoW, YoY, MoM Advice
I'm trying to find the best way to build a KPI overview for a commodity. I have 3 grades of this commodity with new weekly prices. For each need to be able to show: - Week over week price change - Month over month price change - Year over year price change I finished building the week over week and I have 9 DAX measures: - Current Week price - Last week price - Price change % My list is growing as I get into Month over Month..... Is this really the best method???Solved1.3KViews0likes4CommentsDisplay Two Different Dates from the same point on the X axis.
Hi, me again. I want to plot two lines that start from different dates in POWER BI. I have products that have a differents date of creation and i have to display the product since it launch on a line chart as X=0, so that my users get an understanding of how the respective product have fallen in delincuency product launch. This is what i currently have: This just a running total of the percentage of clients that fell into delincuency, but notice that both of these linnes start at different dates, they should star at point 0, measured by the numbers of weeks since the product launched. Sometihng like: Imagine that in the X axis we have numbers from 0 to whatever and that both start from 0, i just picked the two closest that i had. I'll leave a mockup file attached, product of previous help: https://drive.google.com/file/d/1uems6jCzxqkJHNdtcnXxxHxBo222XPB1/view?usp=drive_linkSolved1KViews0likes3CommentsPYTD Function Issue
I need the PYTD function to give me just the total of sales for the same period last year as the current year period. This is the formula I am using for YTD: YTD = TOTALYTD(SUM('Combined Table'[Quota Credit]), 'Combined Table'[QR Date].[Date]) This is the formula for PYTD: QC PYTD = CALCULATE(TOTALYTD(SUM('Combined Table'[Quota Credit]), 'Combined Table'[QR Date].[Date]), SAMEPERIODLASTYEAR('Combined Table'[QR Date].[Date])) For some reason, for PYTD it is giving me the total sales for the year and not just the sales for last year that match up to the current time period in this year. Any suggestions would be great!Solved4KViews0likes2CommentsAmount from today last year until yesterday current year
Hi, if today is 28/06/2024 i want the total amount of measure Sold from 28/06/2023 UNTIL 27/06/2024. I have table Time and columns Date, Year, Day, Month I have measure Sold How i can reach this result? Thank you so muchSolved595Views0likes3CommentsCalculate task forecasts with time intelligence based on summing a value
Hello all, My business case is that I have a nursery. I'm recording GDUs (growing degree units) each day and have a calculated column set up that if I populate my known GDU accumulated by day it uses that value (good for past dates and today). I forecast avg historical GDU into the calculation for future dates, and I have the planting dates for my crops. How can I predict the task date based off of summing the GDUs until the known GDU requirement has been met? Here is my planting list table of required GDU for task and the date it was planted: 'checklist' Variety GDU required Planting Date Bell Pepper A 1401 4/15/2024 Bell Pepper B 1360 4/21/2024 Bell Pepper C 1360 4/30/2024 Bell Pepper D 1314 5/3/2024 Bell Pepper E 1353 5/5/2024 Bell Pepper F 1290 5/8/2024 Cantelope A 1000 4/25/2024 Cantelope B 1060 4/30/2024 Watermelon A 1450 4/15/2024 Watermelon B 1400 4/21/2024 Watermelon C 1425 4/30/2024 Tomato A 1337 4/30/2024 Tomato B 1324 5/3/2024 Tomato C 1312 5/5/2024 Tomato D 1353 5/8/2024 Spinach A 650 5/3/2024 Spinach B 700 5/5/2024 Spinach C 630 5/8/2024 Here is my GDU table (I know it's long), where each day I input actual GDU, and future dates are the avg/day historically: 'GDU tracking'[CalculatedGDUs] being the column of interest Date Low High GDU CalculatedGDUs 5/1/2024 52 71 11.5 11.5 5/2/2024 54 66 10 10 5/3/2024 42 73 11.5 11.5 5/4/2024 48 68 9 9 5/5/2024 40 69 9.5 9.5 5/6/2024 54 76 15 15 5/7/2024 57 77 17 17 5/8/2024 52 81 16.5 16.5 5/9/2024 54 65 9.5 9.5 5/10/2024 51 73 12 12 5/11/2024 46 78 14 14 5/12/2024 49 86 18 18 5/13/2024 61 73 17 17 5/14/2024 0 15 5/15/2024 0 15 5/16/2024 0 15 5/17/2024 0 15 5/18/2024 0 15 5/19/2024 0 15 5/20/2024 0 15 5/21/2024 0 15 5/22/2024 0 15 5/23/2024 0 15 5/24/2024 0 15 5/25/2024 0 15 5/26/2024 0 15 5/27/2024 0 15 5/28/2024 0 15 5/29/2024 0 15 5/30/2024 0 15 5/31/2024 0 15 6/1/2024 0 21 6/2/2024 0 21 6/3/2024 0 21 6/4/2024 0 21 6/5/2024 0 21 6/6/2024 0 21 6/7/2024 0 21 6/8/2024 0 21 6/9/2024 0 21 6/10/2024 0 21 6/11/2024 0 21 6/12/2024 0 21 6/13/2024 0 21 6/14/2024 0 21 6/15/2024 0 21 6/16/2024 0 21 6/17/2024 0 21 6/18/2024 0 21 6/19/2024 0 21 6/20/2024 0 21 6/21/2024 0 21 6/22/2024 0 21 6/23/2024 0 21 6/24/2024 0 21 6/25/2024 0 21 6/26/2024 0 21 6/27/2024 0 21 6/28/2024 0 21 6/29/2024 0 21 6/30/2024 0 21 7/1/2024 0 23 7/2/2024 0 23 7/3/2024 0 23 7/4/2024 0 23 7/5/2024 0 23 7/6/2024 0 23 7/7/2024 0 23 7/8/2024 0 23 7/9/2024 0 23 7/10/2024 0 23 7/11/2024 0 23 7/12/2024 0 23 7/13/2024 0 23 7/14/2024 0 23 7/15/2024 0 23 7/16/2024 0 23 7/17/2024 0 23 7/18/2024 0 23 7/19/2024 0 23 7/20/2024 0 23 7/21/2024 0 23 7/22/2024 0 23 7/23/2024 0 23 7/24/2024 0 23 7/25/2024 0 23 7/26/2024 0 23 7/27/2024 0 23 7/28/2024 0 23 7/29/2024 0 23 7/30/2024 0 23 7/31/2024 0 I'd like to forecast, based off of the planting date, adding GDUs in the 'GDU tracking'[CalculatedGDUs] column, the date on which I can expect my crop to flower, hit a milestone, etc. This would be a calculated column in my 'checklist' table named [ForecastedDate]. Ideally, I'm able to change the value of 'GDU required' in different columns based off of different task needs to generate a to-do list of tasks by date for each crop variety. Where do I start with this? I feel like I'm using VAR and the GDU required column in a CALCULATE function, though I'm not sure the right approach.Solved2.9KViews0likes10CommentsReturn the Maximum count accordingfor past 3 years
I have a table called Safety Observations and counting the Safety Observations serial number and trying to return the maximum in each month for the past two years compare it with the current Year and add it in a trend line, as per the below image. For example, in January looking at the past 2 years - the maximum is in 2023 so it should return 30, meanwhile in February the maximum was in 2022 so I want to return 19. This is the Formula that i have used but its returning the 2024 . Max Per Year = CALCULATE (COUNT('Safety Observations'[SerialNo]) , FILTER ( ALL ( 'Date Dimension' ), 'Date Dimension'[Month] = MAX ( 'Date Dimension'[Month] ) ), DATESINPERIOD ( 'Date Dimension'[Date].[Date], LAST DATE ( 'Date Dimension'[Date].[Date] ), -2, YEAR ) ) Appreciate your guidanceSolved1.1KViews0likes5CommentsFilter a DAX measure with dynamic date filters / Time Intelligence
I need to filter a calculated table to find the metric for a particular department of goods and a dynamic date range. The Sales Cycle should have a Sold % Quantity which is the total items sold divided by the number of items produced. These two numbers need to match: This DAX is not working: Sold % Qty Clothing = VAR _startSalesCycle = DATE(2024, 02, 04) VAR _endSalesCycle = DATE(2024, 02, 27) CALCULATE( [Sold % Qty], 'Production Units by Week'[DepartmentName] = "Donated Clothing", DATESINPERIOD(Dates[Date], _startSalesCycle, _endSalesCycle, DAY ) ) Eventually, I want the start and end of the Sales Cycle to determine how this table gets filtered on a weekly basis. Which date filters should I use?633Views0likes1CommentTime Intelligence: Related time period (by week, weekday) for current year month.
Hello! This far I have found a solution to my problems with DAX in these forums but now I’m really stuck. I’m using Excel Power Pivot, but will be using PowerBI (hopefully) in near future. I’m building a simply daily report having i.e. MTD sales current year and for comparison the sales in related time period previous year: same week, same weekday. For example for the January 2024 the relevant comparison should be from 2nd of January 2023 to 1st of February. I cannot use ISO weeks as the period of current year must be the real month. I found a nice formula to calculate sales per comparison date, but couldn’t find out a way to calculate the cumulative totals as I can’t use MTD, nor SAMEPERIODLASTYEAR for previous year. DATEADD maybe works but I'm a bit worried about its proofness in becoming years. Tried several ways, best tries below. This is something that would probably work, but I could not calculate the start of the relevant period when row context wasn’t the first day of the current month: CALCULATE ( [Total_sales], DATESBETWEEN ( DateTable[Dates] , “start of the relevant period”, “end of the relevant period”) Tried to calculate the comparison date of the first date of the current month with nested calculate but it produces the date only to the spe: CALCULATE ( CALCULATE ( LASTDATE(DateTable[Date] ), FILTER ( ALLSELECTED (DateTable), DateTable[Year] = MAX(DateTable[Year]) -1 ), FILTER ( ALLSELECTED (DateTable), DateTable[Week] = MAX (DateTable[Week]) ), VALUES (DateTable[WeekDay])) , FILTER ( ALLSELECTED (DateTable), DateTable[date] = STARTOFMONTH (DateTable[dates]) ) Then another try with calculating a table with comparison dates for all mtd dates for current year: CALCULATETABLE ( DATESMTD (DateTable[dates]), FILTER ( ALLSELECTED ( DateTable), DateTable[dates] = CALCULATE (LASTDATE(Sales[SalesDate]), FILTER(ALLSELECTED(DateTable), DateTable[Year] = MAX(DateTable[Year])-1), FILTER(ALLSELECTED(DateTable), DateTable[Week] = MAX(DateTable[Week])), VALUES(DateTable[WeekDay]) ) This produces only blanks. There must be a rather simply and sophisticated way to do this. Can anyone help with this?Solved1.5KViews0likes3Comments