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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
sid-poly
Helper I
Helper I

Multi X Axis with different Columns/Measures.

I am looking for a Power BI visual just like the below snapshot.

 

sidpoly_0-1749879112616.png

 

The data looks like the below table

 

DateCountrySupplier PartSub PartTotal QtyTotal Sales
02-06-2025AXX1Y1100040000
03-06-2025AXX1Y120030000
04-06-2025AXX1Y130015000
05-06-2025AXX1Y140010000
06-06-2025AXX1Y1500020000
07-06-2025BYX2Y2600035000
08-06-2025BYX2Y240012000
09-06-2025BYX2Y23000080000
10-06-2025BYX2Y21000

10000

 

I need to have 2 visuals, where one will give Supplier A details and One Supplier B details basis the selection from Single Slicer Supplier. I need to have bar graphs for QTD, YTD, Month(Current), Current Year. It should give me bars of Average Price = (Total Sales/Vol)

 

Anyone who knows how this can be done?

 

I am unable to name the X -axis. I have used the column chart but ended up having Y-axis but no label on X-Axis

6 REPLIES 6
v-tsaipranay
Community Support
Community Support

Hi @sid-poly ,

Thank you for reaching out to the Microsoft Fabric Community.

 

As correctly explained by @danextian  and @Nasif_Azam , using a calculation group on the X-axis will display QTD, MTD, YTD, and Year as separate categories in a single visual. Just ensure "Concatenate labels" is turned off if the labels aren’t showing properly.

If you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.


Thank you.

danextian
Super User
Super User

Hi @sid-poly 

 

You should be able to do that with a dedicated dates table and by using a calculation group.  Create calculation groups
Ensure that the table has been marked as such. Set and use date tables in Power BI Desktop 

danextian_0-1749898632240.png

Sample calclation item formula

QTD =
CALCULATE ( SELECTEDMEASURE (), DATESQTD ( Dates[Date] ) )

danextian_1-1749899329838.gif

 


 Please see the attached pbix.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Nasif_Azam
Solution Specialist
Solution Specialist

Hey @sid-poly ,

To achieve a Power BI visual like the one you sketched with multi-bar (column) visuals showing QTD, YTD, Current Month, and Current Year comparisons based on Average Price.

Objective

Create two visuals (for Supplier A and B) showing Average Price = Total Sales / Total Qty

With these metrics on the X-axis:

  • QTD (Quarter-To-Date)

  • YTD (Year-To-Date)

  • M (Current Month)

  • Y (Current Year Total)

Step 1: Build Measures

In your Power BI data model, create measures using DAX:

AvgPrice_QTD :=
VAR QTD_Sales = CALCULATE(SUM('Table'[Total Sales]), DATESQTD('Table'[Date]))
VAR QTD_Qty = CALCULATE(SUM('Table'[Total Qty]), DATESQTD('Table'[Date]))
RETURN DIVIDE(QTD_Sales, QTD_Qty)

AvgPrice_YTD :=
VAR YTD_Sales = CALCULATE(SUM('Table'[Total Sales]), DATESYTD('Table'[Date]))
VAR YTD_Qty = CALCULATE(SUM('Table'[Total Qty]), DATESYTD('Table'[Date]))
RETURN DIVIDE(YTD_Sales, YTD_Qty)

AvgPrice_Month :=
VAR M_Sales = CALCULATE(SUM('Table'[Total Sales]), DATESMTD('Table'[Date]))
VAR M_Qty = CALCULATE(SUM('Table'[Total Qty]), DATESMTD('Table'[Date]))
RETURN DIVIDE(M_Sales, M_Qty)

AvgPrice_Year :=
VAR YearStart = DATE(YEAR(TODAY()), 1, 1)
VAR Y_Sales = CALCULATE(SUM('Table'[Total Sales]), 'Table'[Date] >= YearStart)
VAR Y_Qty = CALCULATE(SUM('Table'[Total Qty]), 'Table'[Date] >= YearStart)
RETURN DIVIDE(Y_Sales, Y_Qty)

Step 2: Create an Unpivoted Supporting Table for Visual

Create a new table:

AvgPriceView =
DATATABLE(
    "Period", STRING,
    "MeasureName", STRING,
    {
        {"QTD", "AvgPrice_QTD"},
        {"YTD", "AvgPrice_YTD"},
        {"M", "AvgPrice_Month"},
        {"Y", "AvgPrice_Year"}
    }
)

Then, create a switch measure:

AvgPrice_Switch :=
SWITCH(
    SELECTEDVALUE(AvgPriceView[MeasureName]),
    "AvgPrice_QTD", [AvgPrice_QTD],
    "AvgPrice_YTD", [AvgPrice_YTD],
    "AvgPrice_Month", [AvgPrice_Month],
    "AvgPrice_Year", [AvgPrice_Year]
)

Step 3: Create the Visual

  1. Use a Column Chart.

  2. Place AvgPriceView[Period] on the X-axis.

  3. Use the AvgPrice_Switch as Values (Y-axis).

  4. Add a Slicer for Supplier to allow dynamic filtering between Supplier A and B.

For Detailed Information:

Microsoft Docs – Time Intelligence Functions

Radacad – How to Use a Disconnected Table for Dynamic Axis

SQLBI – Using SWITCH for Multiple Measures

Power BI Community – Custom X Axis in Column Chart

 

If you found this solution helpful, please consider accepting it and giving it a kudos (Like) it’s greatly appreciated and helps others find the solution more easily.


Best Regards,
Nasif Azam

This seems to be good,

But if in the Slicer 2 Suppliers are selected, how do I show one visual for Supplier A and another visual for Supplier B? That was also a part of the use case. Can you help me with it?

I provide you the detailed solution with steps, which will be very easy to impliment for you. To handle multiple supplier selections (e.g., both A and B) and still show separate visuals for each, you'll need to do a little modeling and setup in your Power BI report.

Solution

You’ll create two visuals, each filtered to display data only for one supplier, regardless of what's selected in the slicer.

Step 1: Add a Slicer for Supplier

  • Add a slicer visual and put the Supplier field in it.

  • Enable multi-select if needed (so users can pick A and B together).

Step 2: Create Two Measures with Supplier Filters

AvgPrice_QTD_SupplierA :=
VAR QTD_Sales = CALCULATE(SUM('Table'[Total Sales]), DATESQTD('Table'[Date]), 'Table'[Supplier] = "A")
VAR QTD_Qty = CALCULATE(SUM('Table'[Total Qty]), DATESQTD('Table'[Date]), 'Table'[Supplier] = "A")
RETURN DIVIDE(QTD_Sales, QTD_Qty)

Repeat similarly for:

  • AvgPrice_YTD_SupplierA
  • AvgPrice_Month_SupplierA
  • AvgPrice_Year_SupplierA

And do the same for Supplier B with 'Table'[Supplier] = "B".

Step 3: Create a Period Selector Table (Disconnected)

PeriodTable =
DATATABLE(
    "Period", STRING,
    {
        {"QTD"},
        {"YTD"},
        {"Month"},
        {"Year"}
    }
)

Create a slicer using this table, or use it as your X-axis in visuals.

Step 4: Create SWITCH Measures for Each Supplier

Supplier A:

AvgPrice_Switch_SupplierA :=
SWITCH(
    SELECTEDVALUE(PeriodTable[Period]),
    "QTD", [AvgPrice_QTD_SupplierA],
    "YTD", [AvgPrice_YTD_SupplierA],
    "Month", [AvgPrice_Month_SupplierA],
    "Year", [AvgPrice_Year_SupplierA]
)

Supplier B:

Do the same with [AvgPrice_QTD_SupplierB], etc.

Step 5: Build the Visuals

  • Create two clustered column charts:

    • One for Supplier A using PeriodTable[Period] on X-axis and AvgPrice_Switch_SupplierA as values.

    • One for Supplier B using the corresponding measure.

  • Hide axis titles and manually label the visuals above/below as “Supplier A” and “Supplier B” for clarity.

 

For Detailed Information:

Microsoft Docs – Time Intelligence Functions

Radacad – How to Use a Disconnected Table for Dynamic Axis

SQLBI – Using SWITCH for Multiple Measures

Power BI Community – Custom X Axis in Column Chart

 

If you found this solution helpful, please consider accepting it and giving it a kudos (Like) it’s greatly appreciated and helps others find the solution more easily.


Best Regards,
Nasif Azam

pankajnamekar25
Memorable Member
Memorable Member

hi 

(1) Pankaj Namekar | LinkedIn  you can schdule call with me link is in my linkedin bio

Helpful resources

Announcements
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.