Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi All
I'm currently building a bi weekly report with data pulled directly from Salesforce that's wrangled in a different system and I'd like to give the viewers an inside look into performance metrics for a given report pull date (ie 7/31 vs 8/31). I have added example data but I have a couple dax measures using Calculate, distinct, sumx, countx for example. Posted below...
I will be appending the data in one report and am wondering how I can give my viewers the ability to look at the data based on the pulled date of the report (ie. a slicer to choose between 7/31 vs 8/31).
Thanks!!!
What I'd like to answer:
1. Calculate sum and avg amount by contact as of [date]
2. Count the number of instances a count had a win as of [date] (dax below)
Solved! Go to Solution.
Hi @lw24 ,
1. In Power BI, create a new table with the distinct dates from your data.
Dates = DISTINCT('Table'[Date])
Add a slicer to your report and use the new table as the source.
2. For the first question, create two measures to calculate the sum and average amount by contact as of the selected date:
SumAmountByContact =
CALCULATE(
SUM('Table'[Amount]),
'Table'[Date] <= SELECTEDVALUE('Dates'[Date])
)AvgAmountByContact =
CALCULATE(
AVERAGE('Table'[Amount]),
'Table'[Date] <= SELECTEDVALUE('Dates'[Date])
)
3. For the second question, create a measure to count the number of instances a contact had a win as of the selected date:
CountWinsByContact =
CALCULATE(
DISTINCTCOUNT('YourTableName'[Contact ID]),
'YourTableName'[Stage (Bucketed)] = "Won",
'YourTableName'[Date] <= SELECTEDVALUE(Dates[Date])
)
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi @lw24 ,
1. In Power BI, create a new table with the distinct dates from your data.
Dates = DISTINCT('Table'[Date])
Add a slicer to your report and use the new table as the source.
2. For the first question, create two measures to calculate the sum and average amount by contact as of the selected date:
SumAmountByContact =
CALCULATE(
SUM('Table'[Amount]),
'Table'[Date] <= SELECTEDVALUE('Dates'[Date])
)AvgAmountByContact =
CALCULATE(
AVERAGE('Table'[Amount]),
'Table'[Date] <= SELECTEDVALUE('Dates'[Date])
)
3. For the second question, create a measure to count the number of instances a contact had a win as of the selected date:
CountWinsByContact =
CALCULATE(
DISTINCTCOUNT('YourTableName'[Contact ID]),
'YourTableName'[Stage (Bucketed)] = "Won",
'YourTableName'[Date] <= SELECTEDVALUE(Dates[Date])
)
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 47 | |
| 44 | |
| 40 | |
| 20 | |
| 15 |
| User | Count |
|---|---|
| 70 | |
| 68 | |
| 32 | |
| 27 | |
| 25 |