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
Anonymous
Not applicable

Measure on Bar Chart

Hi there :),

 

I am trying to present a measure on a bar chart. The KPI is aggregated in a way that it does a distinctcount over the period of two years to the past and one year to the future. That works fine when presenting it on a card, but when I want to see the above explained aggregated calculation on a time axis, it only seems to reurn the distinctcount for the individual Months. 

Here are the formulas of my measures:

==> Number of Brands:

 IF(
      HASONEVALUE(
          'Time Dimension'[Date (bins)]); CALCULATE(
               DISTINCTCOUNT(
                  ´DataTable´[Brand]); DATESBETWEEN(
                      'Time Dimension'[Date]; [Start-Date(-2to1)]; [End Date(-2to1)]); USERELATIONSHIP(DataTable[Date]; 'Time Dimension'[Date]); DataTable[Brand] <> BLANK()); "Select a Month")

==> Start-Date (-2to1)

Start-Date(-2to1) = DATEADD(VALUES('Time Dimension'[Date (bins)]); -2;YEAR) 

==>End-Date(-2to1)

End Date(-2to1) = 
IF(ISFILTERED('Time Dimension'[Date]) && HASONEVALUE('Time Dimension'[Date]); 
DATEADD(VALUES('Time Dimension'[Date]); 11; MONTH); TODAY())

Eventhough Start and End Date look different they work just the same and provide a single date value.

Any ideas of how to solve this? A christmas miracle would be nice! 😉

Best regards,
chris

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@v-shex-msft, i now found a way how to solve it. So I created a calculated column, with the Start and End Date for each row and instead of using my date table, i used the date column of my data table for the DATESBETWEEN Filter of the Calculate function. 

View solution in original post

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

HI @Anonymous,

 

Can you please share a pbix file with some sample data and expected result for us to testing coding formula?

 

Regards,

Xiaoxin Sheng

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

@v-shex-msft, i now found a way how to solve it. So I created a calculated column, with the Start and End Date for each row and instead of using my date table, i used the date column of my data table for the DATESBETWEEN Filter of the Calculate function. 

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.