Forum Discussion
Calculating averages for a selection with changing reference
- Anonymous5 years ago
Hi Anonymous ,
Sorry for my late reply.
I did not establish a relationship between the two tables to avoid creating a third table.
New measures of Task 3:
(PL)Average price_cm = IF ( ISFILTERED ( 'dim_FL'[PL] ), DIVIDE ( CALCULATE ( SUM ( 'fact_price'[price_cm] ), FILTER ( 'fact_price', [FL] IN VALUES ( 'dim_FL'[FL] ) ) ), CALCULATE ( COUNT ( 'dim_FL'[tag] ), FILTER ( 'dim_FL', [tag] = MAX ( 'fact_price'[Tag] ) ) ) ) )(PL)Average price_pm = IF ( ISFILTERED ( 'dim_FL'[PL] ), DIVIDE ( CALCULATE ( SUM ( 'fact_price'[price_pm] ), FILTER ( 'fact_price', [FL] IN VALUES ( 'dim_FL'[FL] ) ) ), CALCULATE ( COUNT ( 'fact_price'[Tag] ), FILTER ( 'fact_price', [Tag] IN VALUES ( 'dim_FL'[tag] ) && [price_pm] <> BLANK () && [FL] IN VALUES ( 'dim_FL'[FL] ) ) ) ) )I added IF (ISFILTERED ( 'dim_FL'[SFL] ), to other measures.
For more details, you can check from here.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
Could you tell me if your problem has been solved?
If it is, kindly Accept it as the solution. More people will benefit from it.
Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.
Best Regards,
Stephen Tao
- Anonymous5 years agoNot applicable
Hi Anonymous ,
Thank you very much for your reply, and my appologies for my late reply due to Christmas period.
I found your comments and suggestions above very useful and I used them to a great extend to modify my formulas and data model. However, on the way I faced other challenges that I guess should be addressed in a separate topic.
Best regards,
Ilma