Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I am looking for a Power BI visual just like the below snapshot.
The data looks like the below table
Date | Country | Supplier | Part | Sub Part | Total Qty | Total Sales |
02-06-2025 | A | X | X1 | Y1 | 1000 | 40000 |
03-06-2025 | A | X | X1 | Y1 | 200 | 30000 |
04-06-2025 | A | X | X1 | Y1 | 300 | 15000 |
05-06-2025 | A | X | X1 | Y1 | 400 | 10000 |
06-06-2025 | A | X | X1 | Y1 | 5000 | 20000 |
07-06-2025 | B | Y | X2 | Y2 | 6000 | 35000 |
08-06-2025 | B | Y | X2 | Y2 | 400 | 12000 |
09-06-2025 | B | Y | X2 | Y2 | 30000 | 80000 |
10-06-2025 | B | Y | X2 | Y2 | 1000 | 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
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.
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
Sample calclation item formula
QTD =
CALCULATE ( SELECTEDMEASURE (), DATESQTD ( Dates[Date] ) )
Please see the attached pbix.
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.
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)
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)
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] )
Use a Column Chart.
Place AvgPriceView[Period] on the X-axis.
Use the AvgPrice_Switch as Values (Y-axis).
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.
You’ll create two visuals, each filtered to display data only for one supplier, regardless of what's selected in the slicer.
Add a slicer visual and put the Supplier field in it.
Enable multi-select if needed (so users can pick A and B together).
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:
And do the same for Supplier B with 'Table'[Supplier] = "B".
PeriodTable = DATATABLE( "Period", STRING, { {"QTD"}, {"YTD"}, {"Month"}, {"Year"} } )
Create a slicer using this table, or use it as your X-axis in visuals.
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.
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
User | Count |
---|---|
82 | |
72 | |
67 | |
47 | |
36 |
User | Count |
---|---|
111 | |
56 | |
50 | |
42 | |
40 |