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
Giuseppe_a97
New Member

Power bi desktop function (representation)

Hi, I've a Bi desktop problem that I can't fix. I've a table with the following columns: number of train, train maintenance facility, time of departure from station "x", time of arrival at station "y" and I would like to represent in a graph or in a table for each maintenance facility the total number of trains in operation at different times of the day.  Thanks to anyone who can give me a hand

3 REPLIES 3
Greg_Deckler
Super User
Super User

@Giuseppe_a97 
Take a look at these two Quick Measures as I think you want something like them.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364
https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Billing/m-p/409365

 

If you post sample data can be more specific.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler thanks for the answer, but I can't fix yet. I try to post a simple example:

 

maintenance facility --- Departure hour --- Arrival hour --- train

Milano                            07.00                      12.00                  CA7183

Roma                              09.00                      13.00                  AX9283

Napoli                            14.00                       20.00                  BY3273

Milano                            12.00                       21.00                  CI8213

Milano                            12.30                       14.00                  AM1324

Roma                              18.00                       19.00                  OH1132

 

Now the question is: how many trains of the Milan maintenance facility are in operation from 9 to 15?

I would like to have a table/graph that show me this information

 

Thanks

  

@Giuseppe_a97 Use a disconnected time table with the hours you want to track and this measure. PBIX is attached below signature.

Measure = 
    VAR __Table = 
        SELECTCOLUMNS(
            FILTER(
                GENERATE(
                    'Table',
                    'Times'
                ),
                [Hour] >= [departure hour] && [Hour] <= [arrival hour]
            ),
            "Train",[train],
            "Hour",[Hour]
        )
    VAR __Table1 = GROUPBY(__Table, [Train], "Count", COUNTX(CURRENTGROUP(),[Hour]))
    VAR __Result = COUNTROWS(__Table1)
RETURN
    __Result


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

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!

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.