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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
csendrea
Frequent Visitor

Create a bar graph with measures as axis

Hi There

 

I am pretty new to Power BI, but I am quite exciting about this incredible tool. However, I have been having hard times since I am a Excel user and still not getting used to the way DAX works.

 

I hope you could help with this. I have been struggling to find a suitable solution after two days

 

Basically, I need to develope a bar graph which shows total spend by certain brackets and filter by category and totalising by supplier.

 

For example, if the total spend in Supplier 1 in Category 1 is 500 and total spend in Supplier 2 in Category 1 is 400. the graph sould show a total for the bracket of 0-500 of 900 with a count of 2 Supplier.

 

My problem is, if I add all the spend when choosing the bracket is not adding by supplier but by the line.

 

In excel it result quite easy to develop by combining a Pivot Table and Simple Calculations, please refer to images below.

 

However, I do not know how to replicate this in Power BI.

 

I was able to develop the code in DAX

 

Spend Brackets = IF(AND(SUM(Example_Data[Amount])>0,SUM(Example_Data[Amount])<100000),"<100000",IF(SUM(Example_Data[Amount])<800000,"<800000",IF(SUM(Example_Data[Amount])<1500000,"<1500000",">1500000")))

 

which is providing the correct information if I include in a table "Supplier" and "Spend Bracket". However, this do not work to put it ia bar chart

 

Category 1 Power BI.PNGCategory 8 Power BI.PNG

I am trying to insert the file but do not know how


Thanks

 

Carlos

 

Category 1 Excel.PNGCategory 8 Excel.PNGCategory 12 Excel.PNGCategory 17 Excel.PNG

1 ACCEPTED SOLUTION

Hi @v-chuncz-msft

 

Many thanks for your response

 

I was able to create what I wanted with this post

 

https://www.daxpatterns.com/dynamic-segmentation/

 

In any case, many thanks for taking the time to provide help

 

Cheers,

 

Carlos

View solution in original post

3 REPLIES 3
v-chuncz-msft
Community Support
Community Support

@csendrea,

 

You may refer to the following post.

http://community.powerbi.com/t5/Desktop/Variable-Range-based-on-date-filter/m-p/449496#M208072

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-chuncz-msft

 

Many thanks for your response

 

I was able to create what I wanted with this post

 

https://www.daxpatterns.com/dynamic-segmentation/

 

In any case, many thanks for taking the time to provide help

 

Cheers,

 

Carlos

csendrea
Frequent Visitor

Hi all

 

Any ideas about this doubt?

 

Thanks

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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