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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Visualise number of stations by category

Hello,

 

So i have a data set composed of

Table transactions: 

id transaction /station /amount / date

Table Station: 

Station / Location / Country 

And Table Date

 

I can visualise in a Matrix how many transactions per station per time(month, year, day ,week... ). 

Using the function number of transactions (NbreTransactions N = COUNTX(Tbl_Transactions,Tbl_Transactions[ID Transaction]))

The visualition looks like this:

Stationmonth 1month 2month 3
A5055100
B026
C11000

Morover i have edited the visual So that the number appear in colors based on the category ( green >5 yellow >0 and red=0). You get the idea.

 

My problem is I want a visual where i can track the number of stations by Number of transaction per period by category.

I want the final result in a stacked histogram.

For the table above Example :

month 1 the stacked histogram divided into 3 part where it shows 1/3 red 1/3 yellow 1/3 green.

month 2 the stacked histogram divided into 2 part where it shows 1/3 yellow 2/3 green.

month 3 the stacked histogram divided into 2 part where it shows 1/3 red 2/3 green.

 

I'm really lost any help is appreciated.

Thank you.

 

1 ACCEPTED SOLUTION
v-chenwuz-msft
Community Support
Community Support

Hi  , 

Is this you want?

vchenwuzmsft_0-1656649439071.png

 

If yes, please follow these steps to do.

1 Create a color table via 

Table = {("RED",1),("GREEN",3),("YELLOW",2)}

2 Create a measure:

 

measure =
VAR _S =
    SUMMARIZE ( 'FACT TABLE', [Station], "COUNT", [NbreTransactions N] )
VAR _R =
    COUNTROWS ( FILTER ( _S, [COUNT] = 0 ) ) + 0
VAR _Y =
    COUNTROWS ( FILTER ( _S, [COUNT] > 0 && [COUNT] < 5 ) ) + 0
VAR _G =
    COUNTROWS ( FILTER ( _S, [COUNT] > 5 ) ) + 0
RETURN
    SWITCH ( SELECTEDVALUE ( 'Table'[Color] ), "RED", _R, "YELLOW", _Y, _G )

 

3 Create a visual and put this measure in y-axis, month in x-axis and color in legend. 

 

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

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

View solution in original post

2 REPLIES 2
v-chenwuz-msft
Community Support
Community Support

Hi  , 

Is this you want?

vchenwuzmsft_0-1656649439071.png

 

If yes, please follow these steps to do.

1 Create a color table via 

Table = {("RED",1),("GREEN",3),("YELLOW",2)}

2 Create a measure:

 

measure =
VAR _S =
    SUMMARIZE ( 'FACT TABLE', [Station], "COUNT", [NbreTransactions N] )
VAR _R =
    COUNTROWS ( FILTER ( _S, [COUNT] = 0 ) ) + 0
VAR _Y =
    COUNTROWS ( FILTER ( _S, [COUNT] > 0 && [COUNT] < 5 ) ) + 0
VAR _G =
    COUNTROWS ( FILTER ( _S, [COUNT] > 5 ) ) + 0
RETURN
    SWITCH ( SELECTEDVALUE ( 'Table'[Color] ), "RED", _R, "YELLOW", _Y, _G )

 

3 Create a visual and put this measure in y-axis, month in x-axis and color in legend. 

 

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

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

Anonymous
Not applicable

Thank you and have a nice day.

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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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