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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Gopal_PV
Helper I
Helper I

How to use case kind statement to search and display out put on another column

Hi Folks,

I have Period ,FeeType, FeeDescri columns in my model. i want to add new column based on Period and Feetype. 

Ex: 2022Q1 and QF then i want to add First Quarter 2002 + FeeDescri

Ex2: 202209 and MF then i want to add September 2022+ FeeDescri

Can we achive this with DAX. Please help me

Thanks in Advance.

Net.png

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Gopal_PV 
Please refer to attached sample file with the proposed solution

1.png

Result = 
VAR CurrentDescription = 'Table'[FeeDescri]
VAR CurrentPeriod = 'Table'[Period]
VAR CurrentYear = LEFT ( CurrentPeriod, 4 )
VAR MonthOrQuarter1 = SUBSTITUTE ( CurrentPeriod, CurrentYear, "" )
VAR  MonthOrQuarter2 =
    IF (
        ISERROR ( VALUE ( CurrentPeriod) ), 
        SWITCH ( 
            RIGHT ( MonthOrQuarter1, 1 ),
            "1", "First Quarter",
            "2", "Second Quarter",
            "3", "Third Quarter",
            "4", "Fourth Quarter"
        ),
        FORMAT ( DATE ( CurrentYear, MonthOrQuarter1, 1 ), "mmmm" )
    )
RETURN
    MonthOrQuarter2 & " " & CurrentYear & " " & CurrentDescription

View solution in original post

1 REPLY 1
tamerj1
Super User
Super User

Hi @Gopal_PV 
Please refer to attached sample file with the proposed solution

1.png

Result = 
VAR CurrentDescription = 'Table'[FeeDescri]
VAR CurrentPeriod = 'Table'[Period]
VAR CurrentYear = LEFT ( CurrentPeriod, 4 )
VAR MonthOrQuarter1 = SUBSTITUTE ( CurrentPeriod, CurrentYear, "" )
VAR  MonthOrQuarter2 =
    IF (
        ISERROR ( VALUE ( CurrentPeriod) ), 
        SWITCH ( 
            RIGHT ( MonthOrQuarter1, 1 ),
            "1", "First Quarter",
            "2", "Second Quarter",
            "3", "Third Quarter",
            "4", "Fourth Quarter"
        ),
        FORMAT ( DATE ( CurrentYear, MonthOrQuarter1, 1 ), "mmmm" )
    )
RETURN
    MonthOrQuarter2 & " " & CurrentYear & " " & CurrentDescription

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.