Forum Discussion

Mokegubshook's avatar
Mokegubshook
Helper I
1 year ago
Solved

Bar Chart Legend with Parameter

Hello, I want to create bars chart like picture below. My bars chart is made from fields parameter (measure) that is 

[CNTD_Supplier]  --> Distinct of supplier
[CNTD_supplier_file]  --> Distinct of supplier files

 

Both of them will give distinct number of supplier or distinct number of files in everyday if there no legend

 

But I want to color bar base on this condition:

Color By Status = SWITCH(
TRUE(),
[Target] > 0 && [CNT_FILE_ID] = 0, "Not Delivered",
[Target] = 0 && [CNT_FILE_ID] = 0, " No Target",
[CNT_FILE_ID] =[Target], "Delivered By Target",
[CNT_FILE_ID] > [Target], "Deliver More than Target",
"Delivered Less than target"
)

 

Color By completeness = SWITCH(
TRUE(),
[Target] > 0 && [CNT_FILE_ID] = 0, "Not Complete",
[Target] = 0 && [CNT_FILE_ID] = 0, " No Target",
[CNT_FILE_ID] =[Target], "Complete",
[CNT_FILE_ID] > [Target], "Complete",
"No delivery"
)

 

If I select [CNTD_Supplier] (Parameter) It should color the bar by Color By Status or Color By completeness (If it also posible to make this as parameter select) by supplier. For example,please use table below,

 

Supplier A on 1 Jan have target = 1 but send 2 files (Distincy of file ID) --> This should color the bar Color By Status = Deliver More than Target

Supplier A on 2 Jan have target = 1 --> This should color the bar Color By Status = Deliver By Target

My data looklike 

 

My problem is Color By Status got wrong return. It's not return by supplier, it return by file name

 

 

 

4 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Mokegubshook Can you share sample data or a sample pbix file?

     

    Sorry, having trouble following, can you post sample data as text and expected output?
    Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

    Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

    The most important parts are:
    1. Sample data as text, use the table tool in the editing bar
    2. Expected output from sample data
    3. Explanation in words of how to get from 1. to 2.

  • v-echaithra's avatar
    v-echaithra
    Community Support

    Hi Mokegubshook ,

    As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
    If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

     

    Regards,
    Chaithra.

  • v-echaithra's avatar
    v-echaithra
    Community Support

    Hi Mokegubshook ,

    We wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
    If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

     

    Regards,
    Chaithra.

  • v-echaithra's avatar
    v-echaithra
    Community Support

    Hi Mokegubshook 

    As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
    If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

     

    Regards,
    Chaithra.