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
punati33
Regular Visitor

Based on selection chart for Month vs YTD

I have a table where my data is based on Month level , for the same i am planning to generate below DashBoard

 

columns in table

#customersMonth[MM/DD/YYYY]segment

 

CurrentMnthCustomers       YeartoDateCustomers

65                                                  200

Based on above   selection i would like to perform interactions on the below chart i am planning in the same Dashboard

 

For reference i am showing on separate tables however based on above selection i want to provide these numbers in on table

 

currentmnthselection should update below table dynamically 

customers in segment Acustomers in segment Bcustomers in segment C
152030

 

Similarly YeartoDatecustomers should update dynamically 

      

Customer segment ACustomer segment BCustomer segment C
5010050
6 REPLIES 6
v-yiruan-msft
Community Support
Community Support

Hi @punati33 ,

Please create one date dimension table first and create two measures as below:

CurrentMnthCustomers =
VAR summarizedTable =
    SUMMARIZE (
        'Customers',
        'Customers'[segment],
        "CurrentMnthCustomers", CALCULATE (
            COUNT ( 'Customers'[#customers] ),
            FILTER (
                'Customers',
                'Customers'[Month].[Year] = SELECTEDVALUE ( 'Calendar'[Date].[Year] )
                    && 'Customers'[Month].[Month] = SELECTEDVALUE ( 'Calendar'[Date].[Month] )
            )
        )
    )
RETURN
    SUMX ( summarizedTable, [CurrentMnthCustomers] )
YeartoDateCustomers = TOTALYTD(COUNT('Customers'[#customers]),'Calendar'[Date])  

customercount.JPG

Best Regards

Rena

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

Thank you Rena,

 

I  implemented the below solution by creating calendar dim , however after implementing changes i don't see YTD[ its not chaging according to the month i am selecing ] and currentmonth data displayed expecpt for January & Decemeber

 

 

Below is the DAX i am using

 

CurrentMnthCustomers =
VAR summarizedTable =
SUMMARIZE (
'Query2',
'Query2'[fns],
"CurrentMnthCustomers", CALCULATE (
sum ( 'Query2'[num_subs] ),
FILTER (
'Query2',
YEAR('Query2'[mnth]) = SELECTEDVALUE ( 'calendar'[Date].[Year] ) && FORMAT(MONTH('Query2'[date]),"mmmm") = SELECTEDVALUE ( 'calendar'[mnth].[Month] )
)
)
)
RETURN
SUMX ( summarizedTable, [CurrentMnthCustomers] )
 
 
 

Hi @punati33 ,

The field applied on slicer which used to filter month is from table "calendar"  or the fact table "Query2" in your report? It should be from table calendar...

Best Regards

Rena

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

Thank you for Quick response i am using calendar filter

Hi @punati33 ,

Could you please provide some sample data in Query2? It is better if you can provide your sample PBIX file if it is convenient. Then I make troubleshooting based on the provided information. Thank you.

Best Regards

Rena

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

 

It seems that your fact table has a date column (Month[MM/DD/YYYY]) but I am assuming you do not have a date table in your model.

By adding a date table and creating a relationship to your fact table on the date column, you will be able to use time intelligence functions for things like year-to-date.

Let me know if this helps?

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.