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
GunnerJ
Post Patron
Post Patron

Combining two measures based on different dates to the same visual

I want to show two seperate measures next to each other on a bar chart. However the filter context seems to mess up when I put them on the same chart. I tried creating a date table but haven't had luck with that. My end goal is to show "yearly Disconnects" and "yearly active subs" side by side. They show the total active subscribers and the total # of lost accounts during a calendar year.

 

In the screenshot below you can see how the (top) disconnects don't line up like the do in the middle visual. 

Subs compare.PNG

Yearly Disconnects =
VAR FirstDayYear = CALCULATE(STARTOFYEAR('Attrition Rate'[MAXDISCDT]))
VAR LastDayYear = CALCULATE(ENDOFYEAR('Attrition Rate'[MAXDISCDT]))
VAR yearlydisconnects =
CALCULATE(
COUNT('Attrition Rate'[ACCT]),
FILTER(
ALLSELECTED('Attrition Rate'),
AND('Attrition Rate'[MAXDISCDT] <= LastDayYear,'Attrition Rate'[MAXDISCDT]>= FirstDayYear)
),'Attrition Rate'[MINDISCDT] > DATEVALUE("1/1/1800"), USERELATIONSHIP('Attrition Rate'[MAXDISCDT],'Attrition Date'[Date])
)
Return yearlydisconnects
--------------------------------------------------------------------------------
Yearly Active Subs =
VAR FirstDayYear = CALCULATE(STARTOFYEAR('Attrition Rate'[STARTDT]))
VAR LastDayYear = CALCULATE(ENDOFYEAR('Attrition Rate'[STARTDT]))
VAR yearlysubs =
CALCULATE(
COUNT('Attrition Rate'[ACCT]),
FILTER(
ALLSELECTED('Attrition Rate'),
AND('Attrition Rate'[STARTDT] <= LastDayYear, 'Attrition Rate'[STARTDT] <> BLANK())
),'Attrition Rate'[MINDISCDT] = DATEVALUE("1/1/1800"),'Attrition Date'[Date]<>BLANK()
)
Return yearlysubs

 

This link has the test file in question if it will help. Please let me know if there's any additional info I could provide. 

https://www.dropbox.com/s/58jc5ksiacerdpz/Test%20Attrition%20File.pbix?dl=0

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

Hi @GunnerJ ,

 

I checked your file. The problem is that the context of the filter conditions of the two measures is inconsistent.

Please use the calendar table as the x-axis and the calendar table as the filter table. Please refer to this pbix.

Vlianlmsft_0-1636443914333.png

 

 

Best Regards,
Liang
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

4 REPLIES 4
V-lianl-msft
Community Support
Community Support

Hi @GunnerJ ,

 

I checked your file. The problem is that the context of the filter conditions of the two measures is inconsistent.

Please use the calendar table as the x-axis and the calendar table as the filter table. Please refer to this pbix.

Vlianlmsft_0-1636443914333.png

 

 

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

CheenuSing
Community Champion
Community Champion

Hi @GunnerJ ,

 

Can you explain what exactly you want to compute and what should be expected values to be shown as output.

 

Cheers

 

CheenuSing

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

@CheenuSing Yes, I want to see teh Monthly Disconnects and Monthly actives on the same bar chart. Examples for 2017 are shown below. For disconnects I have the accounts shown to illustrate how the monthly value is determined. Jan, Mar, and May all have one account each so their total is one each. June and July had 6 accounts so their monthly totals are 6. It's the same concept for active subs but just with it's own measure. "Monthly Disconnects2" and "Monthly Active Subs" but give the correct values when compared to the date value shown in their measure but I need both measures on the same visual for easy comparison. Does this help?

GunnerJ_0-1636029746314.png

GunnerJ_1-1636029840226.png

 

 

@CheenuSing was my last reply of any help? Please let me know if any addtional information would be useful!

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.