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:

  1. Rows: Days of the week (e.g., Monday, Tuesday, etc.).
  2. Columns: Year-Month combinations (e.g., 2024-11, 2024-12).
  3. 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:

  1. Rows: Days of the week (e.g., Monday, Tuesday, etc.).
  2. Columns: Year-Month combinations (e.g., 2024-11, 2024-12).
  3. 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 badges
Add a comment  | 

1 Answer 1

Reset to default 1

you 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

本文标签: