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 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)
The Generate Table function might help here, not entirely sure...
Hi Whitewhater100,
Thank you very much. Unfortunately, it did not work.
Regards,
- Whitewater1004 years ago
Solution Sage
Hi:
I checked the measure and it is working. I have added a table with the measure. You can fliter out months as needed or maybe you want to see the months for future calculations.https://drive.google.com/file/d/1POgyUikMWl4Oywy75Z1v9QCs8lbUC-DY/view?usp=sharing
I hope this is closer.
- VikrantC4 years ago
Helper I
Hi Whitewater100,
Thank you fro trying. Basically, your results are same as my Table2. What I am trying to do is not create the table2 but directly create Table3. In my original post the Table3 is basically there are three columns: Date, productA and ProductB. The rows are MOM%. I can do the price but NOT the MOM%.
Again, thanks for you trying and helping.
Regards,
VC