The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello,
I have a slicer set up like this:
Using this slicer, I calculate CY and PY YTD gross revenue with the following commands:
Solved! Go to Solution.
HI , @Anonymous
According to your description, you want to " two 12-month running gross revenue totals from 1-year and also 16-months prior to the max date of the slicer".
Here are the steps you can refer to :
(1)This is my test data , you can see if i understand your need:
(2)We can create two measure like this:
Running 1-year = var _slicer = MAXX( ALLSELECTED('dim CalendarDate') ,[CalendarDateKey])
var _pre12years = EDATE(_slicer,-12)
var _pre24years = EDATE(_slicer,-24)
var _t =FILTER( ADDCOLUMNS( ALL('dim CalendarDate') , "CY" , [CYTotalGrossRevenue]) , [CalendarDateKey]>=_pre24years && [CalendarDateKey]<= _pre12years)
return
sumx(_t,[CY])
Running 16-months = var _slicer = MAXX( ALLSELECTED('dim CalendarDate') ,[CalendarDateKey])
var _pre16years = EDATE(_slicer,-16)
var _pre28years = EDATE(_slicer,-28)
var _t =FILTER( ADDCOLUMNS( ALL('dim CalendarDate') , "CY" , [CYTotalGrossRevenue]) , [CalendarDateKey]>=_pre28years && [CalendarDateKey]<= _pre16years)
return
sumx(_t,[CY])
Then we can put the measure on the visual and we can get this:
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
HI , @Anonymous
According to your description, you want to " two 12-month running gross revenue totals from 1-year and also 16-months prior to the max date of the slicer".
Here are the steps you can refer to :
(1)This is my test data , you can see if i understand your need:
(2)We can create two measure like this:
Running 1-year = var _slicer = MAXX( ALLSELECTED('dim CalendarDate') ,[CalendarDateKey])
var _pre12years = EDATE(_slicer,-12)
var _pre24years = EDATE(_slicer,-24)
var _t =FILTER( ADDCOLUMNS( ALL('dim CalendarDate') , "CY" , [CYTotalGrossRevenue]) , [CalendarDateKey]>=_pre24years && [CalendarDateKey]<= _pre12years)
return
sumx(_t,[CY])
Running 16-months = var _slicer = MAXX( ALLSELECTED('dim CalendarDate') ,[CalendarDateKey])
var _pre16years = EDATE(_slicer,-16)
var _pre28years = EDATE(_slicer,-28)
var _t =FILTER( ADDCOLUMNS( ALL('dim CalendarDate') , "CY" , [CYTotalGrossRevenue]) , [CalendarDateKey]>=_pre28years && [CalendarDateKey]<= _pre16years)
return
sumx(_t,[CY])
Then we can put the measure on the visual and we can get this:
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
User | Count |
---|---|
15 | |
8 | |
6 | |
6 | |
6 |
User | Count |
---|---|
23 | |
14 | |
13 | |
8 | |
8 |