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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.