Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I need to calculate the Last 3 Months of Production using Dax. I feel like the code below should be correct, but is missing something simple. Can I use the word month, when using FiscalMonth Sales? Are there any other metrics needed? I also have access to a Calendar Table which could work.
I attempted a solution but am getting a syntax error.
3 month = CALCULATE( SUM(FactProductionTransactionDetail[Quantity]), DATESINPERIOD(DimDate[FiscalMonthNumber],DimDate[FiscalMonthNumber] = "201912",-3,month))
I attempted a new solution using Calendarmonth instead of FiscalMonth, but got the same result. The other thing I forgot to mention is that I want it to calculate using the selected period instead of an entered period. For instance, instead of typing "6" below, I want it to calculate previous 3 months sales based on a filter or a month column if the view is in a table.
3 month = CALCULATE( SUM(FactProductionTransactionDetail[Quantity]), DATESINPERIOD(DimDate[CalendarMonthNumber],DimDate[CalendarMonthNumber] = "6",-3,month))
Please modify the measure using dax below and check if it can meet your requirement:
3 month = CALCULATE ( SUM ( FactProductionTransactionDetail[Quantity] ), DATESINPERIOD ( DimDate[CalendarMonthNumber], DimDate[CalendarMonthNumber] = SELECTEDVALUE ( Table[Selection] ), -3, MONTH ) )
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Can you use SELECTEDVALUE in an Analysis Services connection?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
100 | |
88 | |
68 | |
61 |
User | Count |
---|---|
150 | |
120 | |
100 | |
87 | |
68 |