Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
AK1982
Frequent Visitor

Report with WTD,MTD,QTD and YTD, to support stacked column chart

Hi,

 

I am trying to create a report to display values a below, ending up with below result.

 

Could you please help out to resolve the issue.

 

Source Data:

 

Sale Datesale_status
2021-01-11 00:00:00.0000000R
2021-01-11 00:00:00.0000000R
2021-01-11 00:00:00.0000000R
2021-01-14 00:00:00.0000000R
2021-01-14 00:00:00.0000000S
2021-01-14 00:00:00.0000000S
2021-01-14 00:00:00.0000000S
2021-01-14 00:00:00.0000000S
2021-01-17 00:00:00.0000000R
2021-01-17 00:00:00.0000000S

 

Data Output required:

 

LABELNet_Salesretruns
WTD7220
MTD38088
QTD1208196
YTD1716162

 

netsales = total count of sale_status

retruns = total count of retruns from sale_staus ='R'

 

result i am ending up:

 

LBLMTD_N1QTD_N1WTD_N1YTD_N1
MTD3381166531674
QTD3381166531674
WTD3381166531674
YTD3381166531674

 

6 REPLIES 6
audreygerred
Super User
Super User

Can you please share a pbix with your measures, joins, fact and dim tables, etc? This will help to troubleshoot the issue.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hello, I am assuming that 1 is a return in the field iscredit. If that is the case, I suggest the following:

  • Connect Date from dimdate to the date field in your fact table (sales_units)
  • Mark datedim as a date table
  • Convert iscredit to a text field so that we can use it to create a filtered measure
  • Create a measure for Net Sales: NetSales = COUNT(sales_units[iscredit])
  • Create a measure for Returns (using quick measure for filtered value) and filter to the 1 in is credit. Should return a measure like this: Returns = CALCULATE([NetSales], 'sales_units'[iscredit] IN { "1" })
  • Create MTD, YTD, and QTD measures using quick measures from NetSales and Returns
    • Here is one as an example: NetSales MTD = TOTALMTD([NetSales], 'dimdate'[Date])

Based on the data that was in the file, here is what I get for counts of net sales (assuming to count all rows of iscredit) and returns (assuming to count all rows that have a 1 for the value in iscredit) when I am filtered to 2023 and Q3.

audreygerred_1-1695845794028.png

 

Here are some links that should help when you move onto the week measures you will need, since week is not part of the built in time-intelligence:

https://www.sqlbi.com/articles/week-based-time-intelligence-in-dax/

https://www.daxpatterns.com/week-related-calculations/

 

And here is a blog post I wrote about Date tables with a link to the one I love using the most: http://powerbiwithme.com/2023/08/01/the-custom-date-table-edition/ 

 

Please mark as colution is this solves your issue.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi ,

 

Thank you very much for the solution and Sorry for my delayed reply, I am able view the data, but unable to create below chart with the data in PBI, could you please guide me here.

 

AK1982_0-1696350632918.png

 

Did you create all of the necessary tables, joins, and measures? If so, select the viz you want and then add the measures and filters.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Greg_Deckler
Community Champion
Community Champion

@AK1982 These videos have all of those calculations done multiple different ways and more. 

Also, see these links for more details.

You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors