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.
Hello All,
I am new to DAX and PBI and here as well, this is actually my first question 🙂 so pardon me newbness. I am trying to fgure out a way to return the top product and total revenue (for that product) for the most current month with one measure.
Thus far I have the following:
CurrentSum:= CALCULATE(SUM(Table[Payment]), FILTER(table, table[Payment Year] = YEAR(NOW()) && table[Payment Month] = MONTH(NOW()))) TopProduct:= IF(NOT(ISBLANK([CurrentSum])), IFERROR(CALCULATE(VALUES(table[Product]),TOPN(1, VALUES(table[Product]), [CurrentSum])), "Multiple Products - Tied")) CurrentProductSum:=(CALCULATE([CurrentSum],TOPN(1, VALUES(table[Product]), [CurrentSum])))
These work just fine but I'd like to be able to return these 2 values (TopProduct and CurrentProductSum) withnone measure and possibly a few at a time e.g. top 10 etc. I can do this easily with page level filters but I'd like to be able to do it dynamically with DAX.
Thanks!!!
Hi @dMac314,
You can create a Rank measure based on total revenue of each product. Then, add this Rank measure to "visual level filters", set its value to 1 or less than 10.
Regards,
Yuliana Gu
Thanks for your response @v-yulgu-msft. I understand how to get it done this way but I am looking for a solution that would return everything at once so I wouldnt have to worry about setting any visual level filters.
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 |
---|---|
108 | |
106 | |
87 | |
75 | |
66 |
User | Count |
---|---|
125 | |
114 | |
98 | |
81 | |
73 |