Forum Discussion
Help to create DAX Measure
- 6 months ago
Hi manojk_pbi
Thanks for reaching out to Microsoft Fabric Community Forum.Thanks for providing the sample data. I’ve reproduced the scenario end-to-end in Power BI and validated the expected output.
you’re working on creating DAX measures and calculations to analyze the data between your master and transaction tables. Here’s a guide on how to approach your requirements:
Load the Master and Transaction tables with the provided sample data.
Create a 1:* relationship on PrjID (Master to TransactionTable).
Create a calculated column for Gate Range:Gate Range = SWITCH( TRUE(), Master[Last Passed Gate] IN {"G0","G1","G2"}, "G0-G2", Master[Last Passed Gate] IN {"G3","G4","G5"}, "G3-G5", "Other" )Ageing (Days)_t = VAR AsOfDate = DATE ( 2025, 11, 16 ) RETURN IF ( Master[Gate Passed Dt] <= AsOfDate, 0, DATEDIFF ( AsOfDate, Master[Gate Passed Dt], DAY ) ) test = VAR AsOfDate = SWITCH ( TRUE (), Master[Gate Range] = "G3-G5", DATE ( 2025, 11, 16 ), Master[Gate Range] = "G0-G2", DATE ( 2025, 12, 5 ) ) RETURN IF ( Master[Gate Passed Dt] <= AsOfDate, 0, DATEDIFF ( AsOfDate, Master[Gate Passed Dt], DAY ) )
The Expected output as below :
Hi manojk_pbi
Thanks for reaching out to Microsoft Fabric Community Forum.
Thanks for providing the sample data. I’ve reproduced the scenario end-to-end in Power BI and validated the expected output.
you’re working on creating DAX measures and calculations to analyze the data between your master and transaction tables. Here’s a guide on how to approach your requirements:
Load the Master and Transaction tables with the provided sample data.
Create a 1:* relationship on PrjID (Master to TransactionTable).
Create a calculated column for Gate Range:Gate Range = SWITCH( TRUE(), Master[Last Passed Gate] IN {"G0","G1","G2"}, "G0-G2", Master[Last Passed Gate] IN {"G3","G4","G5"}, "G3-G5", "Other" )Ageing (Days)_t = VAR AsOfDate = DATE ( 2025, 11, 16 ) RETURN IF ( Master[Gate Passed Dt] <= AsOfDate, 0, DATEDIFF ( AsOfDate, Master[Gate Passed Dt], DAY ) ) test = VAR AsOfDate = SWITCH ( TRUE (), Master[Gate Range] = "G3-G5", DATE ( 2025, 11, 16 ), Master[Gate Range] = "G0-G2", DATE ( 2025, 12, 5 ) ) RETURN IF ( Master[Gate Passed Dt] <= AsOfDate, 0, DATEDIFF ( AsOfDate, Master[Gate Passed Dt], DAY ) )
The Expected output as below :
v-aatheeque , thanks for your reply. Your solution and explanation helps
I have posted one more requirement, please guide me .