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
renanpinheiro
Helper I
Helper I

Generic months in a graph

I need to generate a graph as follows:
I have a table with two date fields. The first is DataCriacao, which has the opening of so-called dates. The other is DataConclusao, with the dates on which the calls were closed.
But an open call in January, for example, is not necessarily closed in January.
I need to create a graphic that runs from January to December and that I can count the open calls and closed every month.
As it is now I can not, because the dates do not add up. I need to create a table or something generic dates.

1 ACCEPTED SOLUTION

@renanpinheiro in really high level terms, you could create a date table and associate both your date columns to the same date table. Then in your DAX calculations to count number of calls you would use the "USERELATIONSHIP" function to determine which relationship to use (1 will have to remain inactive)

This blog explains it well, and gives you another option to create multiple tables, but that may mess with one x-axis


Looking for more Power BI tips, tricks & tools? Check out PowerBI.tips the site I co-own with Mike Carlo. Also, if you are near SE WI? Join our PUG Milwaukee Brew City PUG

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi renanpinheiro,

 

According to your description, you want to get the monthly count of ‘DataCriacao’ and ‘DataConclusao’, right?

 

You can refer to below sample:

 

Create a test table contains Operator, DataCriacao, DataConclusao

Capture7.PNG

 

Write the measures to calculate the monthly open and close:

 

Sum of Close/monthly = CALCULATE(COUNTROWS('Operator Records'),FILTER(ALL('Operator Records'),COUNTAX(FILTER('Operator Records',MONTH('Operator Records'[DataConclusao])=MONTH(EARLIER('Operator Records'[DataConclusao]))),'Operator Records'[Operator])) )

 

Sum of Open/monthly = CALCULATE(COUNTROWS('Operator Records'),FILTER(ALL('Operator Records'),COUNTAX(FILTER('Operator Records',MONTH('Operator Records'[DataCriacao])=MONTH(EARLIER('Operator Records'[DataCriacao]))),'Operator Records'[Operator])) )

 

Add then to the table visual:

Capture10.PNG

 

In order to see the result more clearly, create two table with the specify records:

Close = DISTINCT( SELECTCOLUMNS('Operator Records',"Month",MONTH([DataConclusao]),"Count",[Sum of Close/monthly]))

Capture8.PNG

 

Open = DISTINCT( SELECTCOLUMNS('Operator Records',"Month",MONTH([DataCriacao]),"Count",[Sum of Open/monthly]))

Capture9.PNG

 

Regards,

Xiaoxin Sheng

 

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

@renanpinheiro in really high level terms, you could create a date table and associate both your date columns to the same date table. Then in your DAX calculations to count number of calls you would use the "USERELATIONSHIP" function to determine which relationship to use (1 will have to remain inactive)

This blog explains it well, and gives you another option to create multiple tables, but that may mess with one x-axis


Looking for more Power BI tips, tricks & tools? Check out PowerBI.tips the site I co-own with Mike Carlo. Also, if you are near SE WI? Join our PUG Milwaukee Brew City PUG

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.