Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

Average line not to be affected by x-axis values/categories

Hi everyone!

 

I have a bar chart with Year-Month on the x-axis and my y-axis values = average tasks per project.

 

This is an example of my data:

yearMonth Project ID Total Tasks Measure 
20214712481111
20214713601010
202147256722
202157124011
20215712541111
202157199088
202157232211
202157234211
202157235611
202157235711
202157291011
202157295711
202167128111
202167218855
20216722251313
202167235144
202167235266
202167296933

 

So I have the bar chart that represents "Total tasks per project over Time". Now I would like to add a horisontal line representing Average tasks per project over ALL time, but everything I tried (ALL, ALLEXCEPT, FILTER etc) ended up looking like this:

Analyst1991_0-1625235452577.png

I need the orange line to not be affected by the month, but rather Total tasks divided by Total projects divided by 3 months.

The average line made available by the analytics pane gives me the correct value (5.33 in this case), but I need to visualise that value on a Card, and I'm doing something wrong...

Help would be much appreciated!

 

7 REPLIES 7
v-janeyg-msft
Community Support
Community Support

Hi, @Anonymous 

 

How do you get 8, 3, 5 in your visual? Do you choose a specific project? I don't understand your logic very well. Can you explain more information and details? So we can help you soon.

 

Best Regards

Janey Guo

 

 

Anonymous
Not applicable

Hi @v-janeyg-msft I simply added the "total tasks" field to the visual's column values and changed the summarization to Average (8, 5 and 3 were rounded up):

Analyst1991_0-1625485639480.png

 

Hi, @Anonymous 

 

There is no context in the card visual, so you need to create a measure using summarize table.

Like this:

Measure =
AVERAGEX (
    SUMMARIZE (
        ALL ( 'Table' ),
        [yearMonth ],
        "a",
            AVERAGEX (
                FILTER ( ALL ( 'Table' ), [yearMonth ] = SELECTEDVALUE ( 'Table'[yearMonth ] ) ),
                [Total Tasks ]
            )
    ),
    [a]
)

vjaneygmsft_0-1625538664256.png

 

Best Regards

Janey Guo

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

Thank you for your response @v-janeyg-msft

The measure you provided doesn't change when I change my date filter?

FYI I have a calender table that filters this table by Project Completed date.

Hi, @Anonymous 

 

Try to delete all or use allselected instead of all in the formula.

 

Best Regards

Janey Guo

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

@amitchandak unfortunately not 😞

amitchandak
Super User
Super User

@Anonymous , Try if this measure can work

calculate(averageX(values(Table[Yearmonth]),[Measure]), allselected(Table[Yearmonth]))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.