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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Bob639
Regular Visitor

Measuring table

Hello,

I have created a table of measures.

Below is the table obtained:

Bob639_0-1730370294369.png

Type =
VAR OriginalData = ADDCOLUMNS(
    DISTINCT(BD[Type]);
    "Index"; 1
)
VAR NewRow = DATATABLE(
    "Type"; STRING;
    "Index"; INTEGER;
    {
            {"Durée"; 2};
            {"Total intervention"; 3}
    }
)
VAR CombinedData = UNION(OriginalData; NewRow)
RETURN
    SELECTCOLUMNS(
        CombinedData;
        "Type"; [Type];
        "Index"; [Index]
)

Each column is presented with the following (the measurements are identical, only what is in bold changes)!:

40 =
    var _Bat = "40"
    // var _Time = MONTH(NOW()) - 1
    var _Month = [Num_Mois]
    var _Year = YEAR(NOW())
    var _Type = SELECTEDVALUE('Type'[Type])
    var _Mois = if ([Num_Mois] + 1 = 13;
                    1;
                    [Num_Mois] +1
                  )
    var _An = if ([Num_Mois] + 1 = 13;
                    YEAR(NOW()) + 1;
                    YEAR(NOW())
                  )
    var Nb_Interv = COUNTROWS(FILTER(BD;
                                     BD[Bâtiment] = _Bat &&
                                     BD[Type] = _Type &&
                                     BD[Dt Début R] >= date(_Year;_Month;1) &&
                                     BD[Dt Début R] < date(_An;_Mois;1)
                                    )
                            )
    VAR TotalSomme = CALCULATE(
                            SUM(BD[Durée R]);
                            BD[Bâtiment] = _Bat &&
                            BD[Dt Début R] >= DATE(_Year; _Month; 1) &&
                            BD[Dt Début R] < DATE(_An; _Mois; 1)
                            )
    RETURN
    IF( _Type = "Durée";
        TotalSomme;
        Nb_Interv
    )  

The resulting graph:

Bob639_1-1730370704056.png

I had done the same thing in Excel, the table is identical to the one in Power BI but the graph is the one below much more telling:

Bob639_2-1730370881279.png

These work well. With the exception of:

- It doesn't show up in Power Query

- The inverse graph X and Y.

How to make the chart look like the one obtained on Excel.

How to make the sum of each column, lines 1 to 6 and display it on the "Total" row.

Thank you for your feedback.

Kind regards.

2 REPLIES 2
Anonymous
Not applicable

Hi @Bob639 ,

Based on the description, Power Query is primarily used for data transformation and shaping, and it does not execute DAX measures.

Then, invert the X and Y axis options.

vjiewumsft_0-1730446593740.png

 

Best Regards,

Wisdom Wu

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

Hello, Thank you for your feedback. Ok for Power Query, for the graph it just inverts the Y scale (below)

Bob639_0-1730886189247.png

 

It's not what I expect, see initial graph.

Kind regards.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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