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
eliasayyy
Super User
Super User

show me on chart data of all year-month from selected date

hello everyone, 
i have a bar chart which i want to show the values from the beginning of the year(of selected date) until selected date
so lets say i chose november 2022 on my slicer,
i want to show values from january 2022 until november 2022,
if i select may 2021, i want to display values on chart from january 2021 until may 2021
and so on
i dont want the sum of value from jan to selected date but instead,
i want to display each month-year their sum value,

so here i selected march 2022,

annonymous1999_0-1675813944084.png

 

what i want is to display from jan 2022 to march 2022 and it should show like this as if i selected jan 2022 until match 2022

annonymous1999_1-1675813983421.png

 

1 ACCEPTED SOLUTION

Hi @eliasayyy ,

Please have a try.

Create a calendar date table.Then put it into the slicer.

 

Table = CALENDAR(DATE(2022,1,1),DATE(2023,12,31))

 

Then change the measureS.

 

Measure = var _selectedvaluedate=MAXX(ALLSELECTED('Table'),'Table'[Date])
var _month=MONTH(_selectedvaluedate)
var _year=YEAR(_selectedvaluedate)
return 
IF(MAX('Table 1'[MONTH])<=_month&&MAX('Table 1'[YEAR])=_year,1,0)

 

 Then filter the measure is 1.

Then create another measure.

Measure 2 = SUMX(FILTER(ALL('Table 1'),'Table 1'[MONTH]=SELECTEDVALUE('Table 1'[MONTH])&&'Table 1'[YEAR]=SELECTEDVALUE('Table 1'[YEAR])),'Table 1'[value])

vpollymsft_1-1675905796738.png

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

9 REPLIES 9
v-rongtiep-msft
Community Support
Community Support

Hi @eliasayyy ,

I have created a simple sample, please refer to my pbix file to see if it helps you.

Create 2 columns.

YEAR = 
      YEAR('Table 1'[date])
MONTH = 
        MONTH('Table 1'[date])

Then create a measure.

Measur =
VAR _MAXdate =
    MAXX ( ALLSELECTED ( 'Table 1'[date] ), 'Table 1'[date] )
VAR _mindate =
    MINX ( ALLSELECTED ( 'Table 1'[date] ), 'Table 1'[date] )
RETURN
    CALCULATE (
        SUM ( 'Table 1'[value] ),
        FILTER (
            ALL ( 'Table 1' ),
            'Table 1'[YEAR] = SELECTEDVALUE ( 'Table 1'[YEAR] )
                && 'Table 1'[MONTH] = SELECTEDVALUE ( 'Table 1'[MONTH] )
        )
    )

 

vpollymsft_0-1675819767624.png

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

hello @v-rongtiep-msft , i appreciate your reply but i think you got me wrong,
what i want it for my bar chart to show me, if in case i select march 2022 , all dates from january 2022 to march 2022,
if i select december 2021, i want to show all values from january 2021 to december 2021
if i selected february 2023, i want to show all values from january 2023 to february 2023

like i showed in my example above, when i selected march 2022, it only shows march 2022, what i want is AS IF i am selecting all dates from januray 2022 till march 2022, which means i DONT want to select all dates i want this result only from selecting march 2022

hello everyone, 
i have a bar chart which i want to show the values from the beginning of the year(of selected date) until selected date
so lets say i chose november 2022 on my slicer,
i want to show values from january 2022 until november 2022,
if i select may 2021, i want to display values on chart from january 2021 until may 2021
and so on
i dont want the sum of value from jan to selected date but instead,
i want to display each month-year their sum value for each of the period,

so here i selected march 2022,

annonymous1999_0-1675813944084.png

 

what i want is to display from jan 2022 to march 2022 and it should show like this as if i selected jan 2022 until match 2022

annonymous1999_1-1675813983421.png

 

the second picture should be the expected result WITHOUT me having to select the dates,
i only want when i seelct a date, it shows me the values from first month of year to selcted date as explained above.
thank you

 

hi @eliasayyy 

 

not sure if this is feasible. you expects a dynamic axis. an axis is typically feeded with a dataset column, but a dataset column can't be calculated with slicer input.

Hello @FreemanZ ,thank you for your reply is it possible to add another slicer and get what i want when i select a date from 1 slicer until the second slicer?

hi @eliasayyy 

i think that is feasible. please give it a try. 

@FreemanZ i dont know how 😞

hi @eliasayyy 

plot the chart with Month column. Feed a slicer with the Date or Month column. Or?

Hi @eliasayyy ,

Please have a try.

Create a calendar date table.Then put it into the slicer.

 

Table = CALENDAR(DATE(2022,1,1),DATE(2023,12,31))

 

Then change the measureS.

 

Measure = var _selectedvaluedate=MAXX(ALLSELECTED('Table'),'Table'[Date])
var _month=MONTH(_selectedvaluedate)
var _year=YEAR(_selectedvaluedate)
return 
IF(MAX('Table 1'[MONTH])<=_month&&MAX('Table 1'[YEAR])=_year,1,0)

 

 Then filter the measure is 1.

Then create another measure.

Measure 2 = SUMX(FILTER(ALL('Table 1'),'Table 1'[MONTH]=SELECTEDVALUE('Table 1'[MONTH])&&'Table 1'[YEAR]=SELECTEDVALUE('Table 1'[YEAR])),'Table 1'[value])

vpollymsft_1-1675905796738.png

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

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.

Top Solution Authors