Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I have use case where I need double headers such as MTD, YTD and under that I need to have sales,order count, margin and for YTD it shouldn't calculate order count. Any solution for this.
Solved! Go to Solution.
Hi @Laxman222
Method 1: A general technique I've used in the past is:
Example PBIX attached for you to take a look.
Here is the DAX script for the Measure and Measure Visibility calculation groups in my example:
-------------------------------
-- Calculation Group: 'Measure'
-------------------------------
CALCULATIONGROUP 'Measure'[Measure] , Precedence = 1
CALCULATIONITEM "Sales" = [Sales]
, FormatString = "#,0"
, Ordinal = 0
CALCULATIONITEM "Margin" = [Margin]
, FormatString = "#,0.00"
, Ordinal = 1
CALCULATIONITEM "Order Count" = [Order Count]
, FormatString = "#,0"
, Ordinal = 1
------------------------------------------
-- Calculation Group: 'Measure Visibility'
------------------------------------------
CALCULATIONGROUP 'Measure Visibility'[Measure Visibility] , Precedence = 2
CALCULATIONITEM "Exclude Order Count YTD" =
VAR CurrentMeasure =
SELECTEDVALUE ( 'Measure'[Measure] )
VAR CurrentTimeCalc =
SELECTEDVALUE ( 'Time Intelligence'[Time Calc] )
VAR Result =
IF (
NOT ( CurrentMeasure = "Order Count" && CurrentTimeCalc = "YTD" ),
SELECTEDMEASURE ()
)
RETURN
Result
, FormatString = SELECTEDMEASUREFORMATSTRING ()
Method 2: Another (possibly simpler) method is to use the Hierarchy Slicer custom visual to select the desired combinations of Time Intelligence and Measure calculation items. The Hierarchy Slicer will work if a blank measure is placed on it (or you could use another suitable measure).
Well these are a couple of possible approaches. Would something like these work in your case?
Regards
It worked for me
Hi @Laxman222
Method 1: A general technique I've used in the past is:
Example PBIX attached for you to take a look.
Here is the DAX script for the Measure and Measure Visibility calculation groups in my example:
-------------------------------
-- Calculation Group: 'Measure'
-------------------------------
CALCULATIONGROUP 'Measure'[Measure] , Precedence = 1
CALCULATIONITEM "Sales" = [Sales]
, FormatString = "#,0"
, Ordinal = 0
CALCULATIONITEM "Margin" = [Margin]
, FormatString = "#,0.00"
, Ordinal = 1
CALCULATIONITEM "Order Count" = [Order Count]
, FormatString = "#,0"
, Ordinal = 1
------------------------------------------
-- Calculation Group: 'Measure Visibility'
------------------------------------------
CALCULATIONGROUP 'Measure Visibility'[Measure Visibility] , Precedence = 2
CALCULATIONITEM "Exclude Order Count YTD" =
VAR CurrentMeasure =
SELECTEDVALUE ( 'Measure'[Measure] )
VAR CurrentTimeCalc =
SELECTEDVALUE ( 'Time Intelligence'[Time Calc] )
VAR Result =
IF (
NOT ( CurrentMeasure = "Order Count" && CurrentTimeCalc = "YTD" ),
SELECTEDMEASURE ()
)
RETURN
Result
, FormatString = SELECTEDMEASUREFORMATSTRING ()
Method 2: Another (possibly simpler) method is to use the Hierarchy Slicer custom visual to select the desired combinations of Time Intelligence and Measure calculation items. The Hierarchy Slicer will work if a blank measure is placed on it (or you could use another suitable measure).
Well these are a couple of possible approaches. Would something like these work in your case?
Regards
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
15 | |
11 | |
8 | |
8 | |
8 |
User | Count |
---|---|
22 | |
13 | |
11 | |
10 | |
10 |