cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
akfir
Helper V
Helper V

bar chart calculation

Hi dear helpers,
i have this kind of data table and i wish to build the correct measures/calculations in order to show this kind of bar chart (attached below).
i actually need to calculate how many customers were sent X messages successfully.
can you please assist me with the right DAX for it?

for the below data:
in Jan'22, 1 customer (id=2) has been delivered 1 message successfully, and 2 customers (id=1,3) has been delivered successfully 2 different massages

thanks in advance.
image.png

1 ACCEPTED SOLUTION
Arul
Super User
Super User

@akfir ,

first you need to create month name column in your table like below using below code

Month = FORMAT('Messages Delivered'[Date],"MMM-YY")

Arul_0-1653406499609.png

then create a measure using below logic then use it in your visual you will get your desired result,

Count of meassage = 
CALCULATE(COUNT('Messages Delivered'[Customer ID]),'Messages Delivered'[Delivered?]="TRUE")

Arul_1-1653406566864.png

Thanks,

Arul

 

 





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

Proud to be a Super User!




View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi akfir

 

I succeed but I think there is an easy way to do it.

the table name with datas on this page have this name here : 'BAR CHART CALL (2)'

 

 

First I create a new table :

Nbre Message = var _step1=
ADDCOLUMNS(
SUMMARIZE('BAR CHART CALL (2)','BAR CHART CALL (2)'[Customer ID]),
"@NbMess",calculate(COUNT('BAR CHART CALL (2)'[Message ID]),'BAR CHART CALL (2)'[Delivered]="OK",KEEPFILTERS('BAR CHART CALL (2)')))
return
_step1
 
After a second table with generate
Serie message = GENERATESERIES(1,10,1)
 
and finally add a column to this table ==>
Cust = var nbmess='Serie message'[Value]
var result=calculate(count('Nbre Message'[Customer ID]),'Nbre Message'[@NbMess]=nbmess)
return
result
 
At the end I used the last table ot make the graph.
JamesFr06_0-1653410320636.png

Hope this helps but I am pretty sure that there is an easy way to do it !! 🙂

Arul
Super User
Super User

@akfir ,

first you need to create month name column in your table like below using below code

Month = FORMAT('Messages Delivered'[Date],"MMM-YY")

Arul_0-1653406499609.png

then create a measure using below logic then use it in your visual you will get your desired result,

Count of meassage = 
CALCULATE(COUNT('Messages Delivered'[Customer ID]),'Messages Delivered'[Delivered?]="TRUE")

Arul_1-1653406566864.png

Thanks,

Arul

 

 





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

Proud to be a Super User!




Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors