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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Freeseman
Helper II
Helper II

Shaping Dates into categories

Hi All,

 

I am trying to structure my X axis by hour but in a specific order. So by default Power BI would arrange my hours from 0 - 23

or it would kind of just mix them up as below.

Freeseman_0-1660049351800.png

The result i am trying to acheive is like this:

Freeseman_1-1660049407457.png

Please help me in the right direction to replicate the second visual

18 REPLIES 18
Freeseman
Helper II
Helper II

Anybody have ideas:)

Hi, @Freeseman 

You need to enter a custom table and then sort Column ‘Category’ by Column 'Sort column'.

veasonfmsft_4-1660631969912.png

 

After you establish a relationship between the custom table and the fact table, you can replace the existing fields with the new fields like below:

veasonfmsft_2-1660631847350.png

veasonfmsft_3-1660631896161.png

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

@v-easonf-msft Thank you for the advice. Please see https://community.powerbi.com/t5/Desktop/Average-per-Category-Please-help/m-p/2702026#M945089

I managed to get this far. Is the next step possible?

Hi, @Freeseman 

Try to use 'Line and clustered column chart' to replace 'clustered column chart' so that  you can add custom line chart as below:

Average of Part1 = if(MAX('Fact Table'[Category (groups)])="Part1",CALCULATE(AVERAGE('Fact Table'[Value]),FILTER(ALL('Fact Table'),'Fact Table'[Category (groups)]="Part1")))
Average of Part2 = if(MAX('Fact Table'[Category (groups)])="Part2",CALCULATE(AVERAGE('Fact Table'[Value]),FILTER(ALL('Fact Table'),'Fact Table'[Category (groups)]="Part2")))

......

veasonfmsft_0-1660637385253.png

 

Best Regards,
Community Support Team _ Eason

 

@v-easonf-msft 

 

This is extremely helpful.

 

I need the average of the SUM of production per group. I tried this:

 

NS Lunch = if(MAX('PRODUCTION'[TIMESTAMP (groups)])= "2. NS Lunch",CALCULATE(AVERAGE('PRODUCTION'[PRODUCTION]),FILTER(ALL('PRODUCTION'),'PRODUCTION'[TIMESTAMP (groups)]= "2. NS Lunch")))
 
My Average lines do not look good. I need to work something out.
Freeseman_0-1660709063108.png

 

I think it has something to do with the way its grouping the times vs reading the production value?

Production is SUM over multiple timestamps because there are many production values from different machines in the hours. SO i need the sum of the total hour groups production which i believe is possible but the meassure needs to change calculation?

Its making all average line 97.xx

Hi, @Freeseman 

Please convert the chart into a table visual, which will be easy to find the problem.

Can you share a copy of the sample data?

 

Best Regards,
Community Support Team _ Eason

Thank you.

The data is a lot to share as i have many other tabes from other DB tables.

Freeseman_0-1660716825874.png

The way you explain to me is very good and helps me a lot. I just need to fix meassure calculation?

Hi, @Freeseman 

I suspect this has something to do with the date slicers. 

Is 'Shift Date' a field in a separate calendar table?

Will the result of the current measure "Evening Shift Change" change with the value of slicer 'shift_date'?

After you clear the filter criteria for the date slicer, is the calculation result correct?

NS Lunch =
IF (
    MAX ( 'PRODUCTION'[TIMESTAMP (groups)] ) = "2. NS Lunch",
    CALCULATE (
        AVERAGE ( 'PRODUCTION'[PRODUCTION] ),
        FILTER (
            ALL ( 'PRODUCTION' ),
            'PRODUCTION'[TIMESTAMP (groups)] = "2. NS Lunch"
                && 'PRODUCTION'[Shift Date] IN VALUES ( 'PRODUCTION'[Shift Date] )
        )
    )
)

 

Best Regards,
Community Support Team _ Eason

@v-easonf-msft 

 

No Idea where it is getting 96.02 from

Freeseman_0-1660724311685.png

 

Hi @v-easonf-msft 

 

I tried to upload the file for you but its not allowing me.

I tried your new measure but same issue... i am not sure where it is taking this average from because i need the average of the 2 totals (0 and 23)

Freeseman_0-1660723662385.png

 

 

Hi, @Freeseman 

If possible, upload a sample file to cloud storage and share the link here.

 

Best Regards,
Community Support Team _ Eason

 

@v-easonf-msft Please look. 🙂

 

I need help caterorising average per time category per day but also drag slider and need average over time.

 

https://1drv.ms/u/s!Ai_OAtss0EStcVjqwQTgXMKiFsw?e=auxUfP

Hi, @Freeseman 

Sorry for later reply. The link seems to have expired, can you share it again?

Best Regards,
Community Support Team _ Eason

 

@v-easonf-msft I inbox you.

Hi @v-easonf-msft , Struggle with company procedure.

 

Does this help

Freeseman_0-1660730375503.png

I have time stamps but the average is calculated per row and not per category?

Wow, i am amazed. 🙂 Thank you. Let me try this.

Freeseman
Helper II
Helper II

I need the dates ordered from 18,19,20,21,22 then 23,0 Then 1,2,3,4 Then 5,6,7,8 Then 9,10,11 Then 12,13 Then 14,15,16,17

It is from 6pm to 5pm over a 24h

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.