Show Previous Year's Months in Current Year with DAX | DAX TREATAS Function in Power BI

  Рет қаралды 691

Antriksh Sharma

Antriksh Sharma

Күн бұрын

#Dax #PowerBI

Пікірлер: 9
@ExcelFort
@ExcelFort 3 жыл бұрын
Creative solution as always!
@hossein3945
@hossein3945 3 жыл бұрын
Amazing technique Antriksh. Thanks for sharing this amazing video.
@AntrikshSharma
@AntrikshSharma 3 жыл бұрын
Thanks!! :)
@mudassirsyedrashidali9787
@mudassirsyedrashidali9787 3 жыл бұрын
"Filtering should come from the DAX code, not from the slicer." Amazing work here!!
@AntrikshSharma
@AntrikshSharma 3 жыл бұрын
Thanks bro!!
@tarun35
@tarun35 3 жыл бұрын
Thank you so much Antriksh
@qasimjan5258
@qasimjan5258 3 жыл бұрын
Thank you so much Antriksh Sharma.
@Pooja-pd1ee
@Pooja-pd1ee 3 жыл бұрын
Great work here. However, I think the code could be optimized a bit. Physical relations in data model performs better than that in dax so, I might have created an inactive relationship between the two as many to one with many side being the original calendar/date table. And, would have written the code something like: Previous year's 3 months' data = var _date = MAX('Calendar'[Date]) var _p3m = CALCULATETABLE ( SAMEPERIODLASTYEAR('Calendar (copy)'[Date]), DATESINPERIOD('Calendar (copy)'[Date],_date,3,MONTH), 'Calendar (copy)'[YearMonthNo] FORMAT(_Date,"yyyy/mm") ) var _result = CALCULATE( [Measure], _p3m, REMOVEFILTERS('Calendar'), KEEPFILTERS('Calendar (copy)'), USERELATIONSHIP('Calendar (copy)'[Date],'Calendar'[Date]) ) return _result
@AntrikshSharma
@AntrikshSharma 3 жыл бұрын
Thanks! It is true that a physical relationship is orders of magnitude fast but in some case if the values in the filter context are not huge then using TREATAS can optimize the code. In this case the dimension table contain only 2500 rows and I am dealing with 3 values, and this code is super optimized as on a fact table of 12 Million rows it runs in ~39 ms.
[DAX] Best Practices 101 for Optimization & Performance (with Alberto Ferrari)
1:26:41
TOTALMTD vs CALCULATE & DATESMTD in DAX
11:16
Antriksh Sharma
Рет қаралды 5 М.
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН
Арыстанның айқасы, Тәуіржанның шайқасы!
25:51
QosLike / ҚосЛайк / Косылайық
Рет қаралды 700 М.
James Gosling: The Father of Java Programming
5:26
The Technology Teacher
Рет қаралды 10
How to Do a YTD Calculation in Power BI
3:24
Goodly
Рет қаралды 13 М.
DAX Fridays! #124: Weekly time intelligence in Power BI
9:28
Create a Date Table in Power Query & Power BI
45:12
Antriksh Sharma
Рет қаралды 1,2 М.
Connect Python to Power BI and SSAS and run DAX Queries
14:59
Antriksh Sharma
Рет қаралды 14 М.
Learning English is easy, actually
11:52
Veronika's Language Diaries
Рет қаралды 7 М.
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН