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.
Dear all,
I have a production table with several columns, I want to find out the average egg production of last 12 days.
I have written the following code, but the result giving the data of all month and year. what is the problem
EggProductionOfLast12Days := CALCULATE ( AVERAGE ( FactProductionData[Egg Prod#Qty] ), FILTER ( FactProductionData, FactProductionData[Date] <= LASTDATE ( FactProductionData[Date] ) && FactProductionData[Date] >= LASTDATE ( FactProductionData[Date] ) - 12 ) )
Hi @arifulice,
Try this
=CALCULATE(AVERAGE(FactProductionData[Egg Prod#Qty]),DATESBETWEEN(Calendar[Date],MIN(Calendar[Date])-11,MAX(Calendar[Date])))
Hope this helps.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHello MFelix ,
After changing the lastdate by the followiung code, the result is remaining the same like giving the result for month Jan to December.
EggProductionOfLast12Days:=CALCULATE ( AVERAGE ( FactProductionData[Egg Prod#Qty] ), FILTER ( FactProductionData, FactProductionData[Date] <= LASTDATE ( FactProductionData[Date] ) && FactProductionData[Date] >= DATEADD(FactProductionData[Date], -12,DAY) ) )
Hi @arifulice
Another way
= CALCULATE ( AVERAGE ( FactProductionData[Egg Prod#Qty] ), DATESINPERIOD ( FactProductionData[Date], MAX ( FactProductionData[Date] ) - 11, 12, DAY ) )
After applying your DAX ,when i dropped the measure in pivot table the following error message is showing attached in photo
EggProduction:=CALCULATE ( AVERAGE ( FactProductionData[Egg Prod#Qty] ), DATESINPERIOD ( FactProductionData[Date], MAX ( FactProductionData[Date] ) - 11, 12, DAY ) )
I want to see the value of last 12 days but the below link giving the result of all month.please see the attached helow
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 |
---|---|
96 | |
93 | |
83 | |
70 | |
65 |
User | Count |
---|---|
118 | |
106 | |
93 | |
79 | |
72 |