Forum Discussion
Table Transformation with DAX
- 4 years ago
Hi Vikrant:
Off the top of my head I can't see a way to do that, (I'm sure someone knows). Generally, the when the data model is set up with fact and dim tables it allows for easier DAX and more complex analysis at the same time. Staying in one table can only take you so far.
Sorry if this doesn't do the table answer you'd like.
Here is one measure that produces the same results:(with the Date Table in Model)
MOM % Avg Price 2 =var monthavg = AVERAGEX(VALUES(Dates[Month]),average(TableA[Price]))var PrevMontPrice = CALCULATE([Monthly Avg], PREVIOUSMONTH(Dates[Date]))var currprice = SELECTEDVALUE(TableA[Price])var pricediff = monthavg - PrevMontPricevar monumber = SELECTEDVALUE(Dates[Month No.])returnIF( NOT(ISBLANK(currprice) && monumber >=2),DIVIDE(pricediff, [Prev Mont Price]))The Generate Table function might help here, not entirely sure...
Hi VikrantC
You may try
Table3 =
ADDCOLUMNS (
SUMMARIZE ( Table1, Calender[End Of Month] ),
"Product A%", CALCULATE ( [Monthly%_Change], Table1[Product] = "Product A" ),
"Product B%", CALCULATE ( [Monthly%_Change], Table1[Product] = "Product B" )
)- VikrantC4 years ago
Helper I
Awesome, This worked. Thank you very much.
- tamerj14 years ago
Community Champion
Great VikrantC
If it solved your problem, would you please consider marking my reply as accepted solution?
- Whitewater1004 years ago
Solution Sage
Hi VC & TJ:
Tamerj answered correctly and I beleive I mistakenly received credit. Not sure how to ammend that. Thank you. FYI.