admin管理员组文章数量:1122846
Edit. I would like to have average unique visits e.g. average all Mondays, all Tuesdays all Wednesdays in a given month. If there are 4 Tuesdays, I would like to see an average value of visit on Tuesdays in the given month.
I’m working with a PowerPivot table where:
- Rows: Days of the week (e.g., Monday, Tuesday, etc.).
- Columns: Year-Month combinations (e.g., 2024-11, 2024-12).
- Values: I want to calculate the average number of unique occurrences of an ID for each day of the week across the selected months.
The dataset looks like this:
Date | Year_Month | Day_of_Weak | ID |
---|---|---|---|
2024-11-01 | 2024-11 | Friday | A |
2024-11-01 | 2024-11 | Friday | B |
2024-11-08 | 2024-11 | Friday | A |
2024-11-08 | 2024-11 | Friday | C |
2024-12-01 | 2024-12 | Friday | B |
2024-12-01 | 2024-12 | Friday | D |
Edit. I would like to have average unique visits e.g. average all Mondays, all Tuesdays all Wednesdays in a given month. If there are 4 Tuesdays, I would like to see an average value of visit on Tuesdays in the given month.
I’m working with a PowerPivot table where:
- Rows: Days of the week (e.g., Monday, Tuesday, etc.).
- Columns: Year-Month combinations (e.g., 2024-11, 2024-12).
- Values: I want to calculate the average number of unique occurrences of an ID for each day of the week across the selected months.
The dataset looks like this:
Date | Year_Month | Day_of_Weak | ID |
---|---|---|---|
2024-11-01 | 2024-11 | Friday | A |
2024-11-01 | 2024-11 | Friday | B |
2024-11-08 | 2024-11 | Friday | A |
2024-11-08 | 2024-11 | Friday | C |
2024-12-01 | 2024-12 | Friday | B |
2024-12-01 | 2024-12 | Friday | D |
I need the pivot table to look like this:
Day_of_Week | 2024-11 | 2024-12 |
---|---|---|
Monday | N/A | N/A |
Tuesday | N/A | N/A |
Wednesday | N/A | N/A |
Thursday | N/A | N/A |
Friday | 3 | 2 |
Saturday | N/A | N/A |
Sunday | N/A | N/A |
Here:
• For Friday in 2024-11, the unique IDs are {A, B, C} → Count = 3.
• For Friday in 2024-12, the unique IDs are {B, D} → Count = 2.
I attempted the following DAX measure using llm at work I guess it is ChatGPT 4
=AVERAGEX(
FILTER(
'Raport_wszystkich_wejsc_JJ',
'Raport_wszystkich_wejsc_JJ'[Day_of_Weak] = MAX('Raport_wszystkich_wejsc_JJ'[Day_of_Weak]) &&
'Raport_wszystkich_wejsc_JJ'[Year_Month] = MAX('Raport_wszystkich_wejsc_JJ'[Year_Month])
),
DISTINCTCOUNT('Raport_wszystkich_wejsc_JJ'[ID])
)
However, this measure doesn’t work correctly. How can I create a measure to calculate this in PowerPivot?
Share Improve this question edited Nov 22, 2024 at 18:56 Jacek Kotowski asked Nov 21, 2024 at 17:36 Jacek KotowskiJacek Kotowski 70416 silver badges53 bronze badges1 Answer
Reset to default 1you can create a day of week table. There are two columns and sort the day of week column by sort column
then create relationship between two tables
then you can get the result even don't need to create measure
make sure you select show item with no data
本文标签:
版权声明:本文标题:excel - How to calculate the average unique occurrences of an ID for day of the week across months in PowerPivot? - Stack Overfl 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736308370a1933637.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论