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

Don'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.

Reply
Venkat_Thota
Frequent Visitor

Help on converting Qlik calcuation to DAX

I have the below data

RptMonthRptDateRptIndicatorMetric1Metric2
2024 1010/18/20241016
2024 1010/18/2024200
2024 1010/19/20241013
2024 1010/19/2024102
2024 1010/20/2024109
2024 1010/20/2024208
2024 1010/21/20241016
2024 1010/21/2024100
2024 1111/1/20241018
2024 1111/1/20242011
2024 1111/2/20241014
2024 1111/2/2024205
2024 1111/3/20241016
2024 1111/3/20241040
2024 1111/4/20242021
2024 1111/4/2024104
2024 10 350
2024 10 320
2024 11 340
2024 11 360

 

I need the final outcome like this:

RptDateNumDenomFinalMetric
10/18/20251672.285714286
10/19/20241572.142857143
10/20/2024971.285714286
10/21/20241672.285714286
11/1/202418101.8
11/2/202414101.4
11/3/202456105.6
11/4/20244100.4

 

Num is Metric2 total for RptIndicator 1

Demom is Metric1 total for RptIndicator 3 grouped for RptMonth

FinalMetric is Num devided by Denom

 

I am not able to get the month totals (Denom) as there was blanks in RPT Date. its coming as whole year total.

 

2 ACCEPTED SOLUTIONS
bhanu_gautam
Super User
Super User

@Venkat_Thota , Create a calculated column for Num:

Num =
CALCULATE(
SUM('Table'[Metric2]),
'Table'[RptIndicator] = 1
)

 

Create a calculated column for Denom:

Denom =
CALCULATE(
SUM('Table'[Metric1]),
'Table'[RptIndicator] = 3,
ALLEXCEPT('Table', 'Table'[RptMonth])
)

 

Create a calculated column for FinalMetric:

DAX
FinalMetric =
DIVIDE(
'Table'[Num],
'Table'[Denom]
)

 

To ensure that the Denom calculation is correctly grouped by RptMonth and not affected by the blank RptDate, you can use the ALLEXCEPT function to ignore all filters except for RptMonth.

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

v-zhouwen-msft
Community Support
Community Support

Hi all,thanks for the quick reply, I'll add more.

Hi @Venkat_Thota,

Please refer to the attachment for detailed information.

vzhouwenmsft_1-1737083309748.png

 

Best Regards

View solution in original post

5 REPLIES 5
v-zhouwen-msft
Community Support
Community Support

Hi all,thanks for the quick reply, I'll add more.

Hi @Venkat_Thota,

Please refer to the attachment for detailed information.

vzhouwenmsft_1-1737083309748.png

 

Best Regards

Thanks @v-zhouwen-msft . this is also helpful and I am able to resolve my issue.

speedramps
Super User
Super User

We want to help but your description is bit vague. 😀

Try write it more clearly.

Use meaningful field names.

Provide example input data, desired output and clear step by step description.

Try use the same fieldnames and terminology in the input, output and description.

Keep it simple and minimal. Omit anthing that is not required, and format dates correctly.

Dont confuse things by including output measures in the input file. 

 Thanks

bhanu_gautam
Super User
Super User

@Venkat_Thota , Create a calculated column for Num:

Num =
CALCULATE(
SUM('Table'[Metric2]),
'Table'[RptIndicator] = 1
)

 

Create a calculated column for Denom:

Denom =
CALCULATE(
SUM('Table'[Metric1]),
'Table'[RptIndicator] = 3,
ALLEXCEPT('Table', 'Table'[RptMonth])
)

 

Create a calculated column for FinalMetric:

DAX
FinalMetric =
DIVIDE(
'Table'[Num],
'Table'[Denom]
)

 

To ensure that the Denom calculation is correctly grouped by RptMonth and not affected by the blank RptDate, you can use the ALLEXCEPT function to ignore all filters except for RptMonth.

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Thanks @bhanu_gautam . I did same calcuation but didnt work. The only differnece is that I created all as calculated measures. but now as you suggested I created first two as Calculated columns and the last one as a calculated measure. That worked. 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.